summaryrefslogtreecommitdiffstats
path: root/ANNOUNCE-3.1.1 (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-02-13mdadm: fix update=resync regressionMariusz Tkaczyk1-0/+4
mdadm --assemble --update=resync started failing with the error "mdadm: --update=resync not understood for 1.x metadata". It is a regression. Add omitted branch to fix error. Resubmitted, original author is not responding. https://lore.kernel.org/linux-raid/ZZqJlCToUS3Qrl4J@bianca.dpss.psy.unipd.it/ Fixes: 7e8daba8b793 ("super1: refactor the code for enum") Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2024-02-09Revert "mdadm: remove container_enough logic"Mariusz Tkaczyk4-1/+48
Mentioned patch changes way of IMSM member arrays assembling, they are updated by every new drive incremental processes. Previously, member arrays were created and filled once, by last drive incremental process. We determined regressions with various impact. Unfortunately, initial testing didn't show them. Regressions are connected to drive appearance order and may not be reproducible on every configuration, there are at least two know issues for now: - sysfs attributes are filled using old metadata if there is outdated drive and it is enumerated first. - rebuild may be aborted and started from beginning after reboot, if drive under rebuild is enumerated as the last one. This reverts commit 4dde420fc3e24077ab926f79674eaae1b71de10b. It fixes checkpatch issues and reworks logic to remove empty "if" branch in Incremental. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2024-02-09super1: remove support for name= in configMariusz Tkaczyk5-94/+19
Only super1 provides "name=" to config. It is recoreded in metadata so there is no need to duplicate same information. UUID is our main key. It is not used by Incremental and Assemble handles empty name well because other supertypes don't set it in conf. Expectation that the name in config is same as in metadata is bug prone. Config should be the place where use can define customized settings. Remove printing "name=" from mdadm config creation commands. Ignore the name in config file to keep backward compatibility. Remove description from man mdadm.conf. Update 00conftest because "name" is no longer accepted. As the name is ignored, error for mdadm --detail is not printed. Reported-by: Stefan Fleischmann <sfle@kth.se> Fixes: e2eb503bd797 ("mdadm: Follow POSIX Portable Character Set") Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2024-01-24super-intel: Remove inaccessible codeMateusz Kusiak1-17/+0
Remove inaccessible "if" statement from imsm_set_array_state(). Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2024-01-24Replace "none" with macroMateusz Kusiak14-29/+42
String "none" is used many times throughout the code. Replace "none" strings with predefined macro. Add str_is_none() for comparing strings with "none". Replace str(n)cmp calls with function. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2024-01-24Define sysfs max buffer sizeMateusz Kusiak10-52/+54
sysfs_get_str() usages have inconsistant buffer size. This results in wild buffer declarations and redundant memory usage. Define maximum buffer size for sysfs strings. Replace wild sysfs string buffer sizes for globaly defined value. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2024-01-16tests: Gate tests for linear flavor with variable LINEARSong Liu10-3/+60
linear flavor is being removed in the kernel [1], so tests for the linear flavor will fail. Add detection for linear flavor and --disable-linear option, with the same logic as multipath. [1] https://lore.kernel.org/linux-raid/20231214222107.2016042-1-song@kernel.org/ Signed-off-by: Song Liu <song@kernel.org> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2024-01-05manage: adjust checking subarray state in update_subarrayPawel Piatkowski1-1/+2
Only changing bitmap related consistency_policy requires subarray to be inactive. consistency_policy with PPL or NO_PPL value can be changed on active subarray. It fixes regression introduced in commit db10eab68e652f141169 ("Fix --update-subarray on active volume") Signed-off-by: Pawel Piatkowski <pawel.piatkowski@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2023-12-19Remove all "if zeros"Mateusz Kusiak5-127/+0
No more random encounters of "if zeros". Remove all "if 0" code blocks. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2023-11-21udev: Move udev_block() and udev_unblock() into udev.cMateusz Grzonka6-37/+54
Add kernel style comments and better error handling. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-11-21Mdmonitor: Improve udev event handlingMateusz Grzonka8-113/+253
Mdmonitor is waiting for udev queue to become empty. Even if the queue becomes empty, udev might still be processing last event. However we want to wait and wake up mdmonitor when udev finished processing events.. Also, the udev queue interface is considered legacy and should not be used outside of udev. Use udev monitor instead, and wake up mdmonitor on every event triggered by udev for md block device. We need to generate more change events from kernel, because they are missing in some situations, for example, when rebuild started. This will be addressed in a separate patch. Move udev specific code into separate functions, and place them in udev.c file. Also move use_udev() logic from lib.c into newly created file. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26Fix assembling RAID volume by using incrementalPawel Piatkowski1-6/+4
After change "mdadm: remove container_enough logic" IMSM volumes are started immediately. If volume is during reshape, then it will be blocked by block_subarray() during first mdadm -I <devname>. Assemble_container_content() for next disk will see the change because metadata version from sysfs and metadata doesn't match and will execute sysfs_set_array again. Then it fails to set same component_size, it is prohibited by kernel. If array is frozen then first sign from metadata version is different ("/" vs "-"), so exclude it from comparison. All we want is to double check that base properties are set and we don't need to call sysfs_set_array again. Signed-off-by: Pawel Piatkowski <pawel.piatkowski@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm: remove container_enough logicPawel Piatkowski4-46/+1
Arrays without enough disk count will be assembled but not started. Now RAIDs will be assembled always (even if they are failed). RAID devices in all states will be assembled and exposed to mdstat. This change affects only IMSM (for ddf it wasn't used, container_enough was set to true always). Removed this logic from incremental_container as well with runstop checking because runstop condition is being verified in assemble_container_content function. Signed-off-by: Pawel Piatkowski <pawel.piatkowski@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm/super1: Add MD_FEATURE_RAID0_LAYOUT if kernel>=5.4Xiao Ni1-3/+16
After and include kernel v5.4, it adds one feature bit MD_FEATURE_RAID0_LAYOUT. It must need to specify a layout for raid0 with more than one zone. But for raid0 with one zone, in fact it also has a defalut layout. Now for raid0 with one zone, *unknown* layout can be seen when running mdadm -D command. It's the reason that mdadm doesn't set MD_FEATURE_RAID0_LAYOUT for raid0 with one zone. Then in kernel space, super_1_validate sets mddev->layout to -1 because of no MD_FEATURE_RAID0_LAYOUT. In fact, in raid0 io path, it uses the default layout. Set raid0_need_layout to true if kernel_version<=v5.4. Fixes: 329dfc28debb ('Create: add support for RAID0 layouts.') Signed-off-by: Xiao Ni <xni@redhat.com> Reviewed-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm/ddf: Abort when raid disk is smaller in getinfo_super_ddfXiao Ni1-2/+4
The metadata is corrupted when the raid_disk<0. So abort directly. This also can avoid a building error: super-ddf.c:1988:58: error: array subscript -1 is below array bounds of ‘struct phys_disk_entry[0]’ Suggested-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Ackedy-by: Xiao Ni <xni@redhat.com> Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm/tests: Don't run mknod before losetupXiao Ni1-1/+0
Sometimes it can fail: losetup: /var/tmp/mdtest0: failed to set up loop device: No such device or address /dev/loop0 and /var/tmp/mdtest0 are already created before losetup. Because losetup can create device node by itself. So remove mknod. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26Fix race of "mdadm --add" and "mdadm --incremental"Li Xiao Keng1-8/+16
There is a raid1 with sda and sdb. And we add sdc to this raid, it may return -EBUSY. The main process of --add: 1. dev_open(sdc) in Manage_add 2. store_super1(st, di->fd) in write_init_super1 3. fsync(fd) in store_super1 4. close(di->fd) in write_init_super1 5. ioctl(ADD_NEW_DISK) Step 2 and 3 will add sdc to metadata of raid1. There will be udev(change of sdc) event after step4. Then "/usr/sbin/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}" will be run, and the sdc will be added to the raid1. Then step 5 will return -EBUSY because it checks if device isn't claimed in md_import_device()->lock_rdev()->blkdev_get_by_dev() ->blkdev_get(). It will be confusing for users because sdc is added first time. The "incremental" will get map_lock before add sdc to raid1. So we add map_lock before write_init_super in "mdadm --add" to fix the race of "add" and "incremental". Signed-off-by: Li Xiao Keng <lixiaokeng@huawei.com> Signed-off-by: Guanqin Miao <miaoguanqin@huawei.com> Reviewed-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm/tests: Fix regular expression failureXiao Ni1-2/+2
The test fails because of the regular expression. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26Incremental: remove obsoleted calls to udisksColy Li1-51/+13
Utility udisks is removed from udev upstream, calling this obsoleted command in run_udisks() doesn't make any sense now. This patch removes the calls chain of udisks, which includes routines run_udisk(), force_remove(), and 2 locations where force_remove() are called. Considering force_remove() is removed with udisks util, it is fair to remove Manage_stop() inside force_remove() as well. In the two modifications where calling force_remove() are removed, the failure from Manage_subdevs() can be safely ignored, because, 1) udisks doesn't exist, no need to check the return value to umount the file system by udisks and remove the component disk again. 2) After the 'I' inremental remove, there is another 'r' hot remove following up. The first incremental remove is a best-try effort. Therefore in this patch, where force_remove() is removed, the return value of calling Manage_subdevs() is not checked too. Signed-off-by: Coly Li <colyli@suse.de> Reviewed-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Cc: Jes Sorensen <jes@trained-monkey.org> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm: Follow POSIX Portable Character SetMariusz Tkaczyk8-102/+113
When the user creates a device with a name that contains whitespace, mdadm timeouts and throws an error. This issue is caused by udev, which truncates /dev/md link until the first whitespace. This patch introduces prohibition of characters other than A-Za-z0-9.-_ in the device name. Also, it prohibits using leading "-" in device name, so name won't be confused with cli parameter. Set of allowed characters is taken from POSIX 3.280 Portable Character Set. Also, device name length now is limited to NAME_MAX. In some places, there are other requirements for string length (e.g. size up to MD_NAME_MAX for device name). This routine is made to follow POSIX and other, more strict limitations should be checked separately. We are aware of the risk of regression in exceptional cases (as escape_devname function is removed) that should be fixed by updating the array name. The POSIX validation is added for: - 'name' parameter in every mode. - first devlist entry, for Build, Create, Assemble, Manage, Grow. - config entries, both devname and "name=". Additionally, some manual cleanups are made. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm: define ident_set_devname()Mariusz Tkaczyk5-33/+92
Use dedicated set method for ident->devname. Now, devname validation is done early for modes where device is created (Build, Create and Assemble). The rules, used for devname validation are derived from config file. It could cause regression with execeptional cases where existing device has name which doesn't match criteria for Manage and Grow modes. It is low risk and those modes are not omitted from early devname validation. Use can used main numbered devnode to avoid this problem. Messages exposed to user are changed so it might cause a regression in negative scenarios. Error codes are not changed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm: refactor ident->name handlingMariusz Tkaczyk4-23/+104
Create dedicated setter for name in mddev_ident and propagate it. Following changes are made: - move duplicated code from config.c and mdadm.c into new function. - Add error enum in mdadm.h. - Use MD_NAME_MAX instead of hardcoded value in mddev_ident. - Use secure functions. - Add more detailed verification of the name. - make error messages reusable for cmdline and config: - for cmdline, these are errors so use pr_err(). - for config, these are just warnings, so use pr_info(). Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26mdadm: set ident.devname if applicableMariusz Tkaczyk4-71/+55
This patch tries to propagate the usage of struct mddev_ident for cmdline where it is applicable. To avoid regression, this value is derived from devlist->devname for applicable modes only. As a result, the whole structure is passed to some functions. It produces some changes for Build, Create and Assemble. No functional changes intended. The goal of the change is to unify devname validation which is done in next patches. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26tests: create 00confnamesMariusz Tkaczyk2-0/+127
The test is an attempt to document current implementation of devnode and name handling for config entries. It is focused on incremental- default way of array assembling on boot. The expectations are aligned to current implementation for native metadata because it is the most complicated scenario- both variables can be set. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
2023-10-26tests: create names_templateMariusz Tkaczyk2-69/+70
Create templates directory and names_template. Move code from 00createnames. This code will be reused for 00confnames in next patch. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>