summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* mdadm/bitmap: locate bitmap calcuate bitmap position wronglyXiao Ni2021-03-031-3/+9
| | | | | | | | Now it only adds bitmap offset based on cluster nodes. It's not right. It needs to add per node bitmap space to find next node bitmap position. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Dump: get stat from a wrong metadata file when restoring metadataLidong Zhong2020-12-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | The dumped metadata files are shown as below localhost:~ # ll -ih test/ total 16K 34565564 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-3 34565563 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4 34565563 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 sda 34565564 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 sdb It reports such error when trying to restore metadata for /dev/sda localhost:~ # mdadm --restore=test /dev/sda mdadm: test/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4 is not the same size as /dev/sda - cannot restore. It's because the stb value has been changed to other metadata file in the while statement. Signed-off-by: Lidong Zhong <lidong.zhong@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Remove redundant spare movement logicMariusz Tkaczyk2020-12-201-62/+0
| | | | | | | | | | | If policy is set then mdmonitor is responsible for moving spares. This logic is reduntant and potentialy dangerus, spare could be moved at initrd stage depending on drives appearance order. Remove it. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* udev: start grow service automaticallyTkaczyk Mariusz2020-11-261-0/+2
| | | | | | | | | Grow continue via service or fork is started during raid assembly. If raid was assembled in initrd it will be newer restarted after switch root. Add udev support for starting mdadm-grow-continue service. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
* Make target to install binaries onlyKinga Tanska2020-11-261-3/+5
| | | | | | | | Make install causes installation of binaries, udev and man. This commit contains new target make install-bin, which results in installation of binaries only. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
* mdadm/Detail: show correct state for clustered arrayZhao Heming2020-11-263-10/+86
| | | | | | | | | | | | After kernel md module commit 480523feae581, in clustered env, mddev->in_sync always zero, it will make array.state never set up MD_SB_CLEAN. it causes "mdadm -D /dev/mdX" show state 'active' all the time. bitmap.c: add a new API IsBitmapDirty() to support inquiry bitmap dirty or clean. Signed-off-by: Zhao Heming <heming.zhao@suse.com>
* mdadm: Unify forks behaviourMariusz Tkaczyk2020-11-266-101/+100
| | | | | | | | | | | | | | If mdadm is run by udev or systemd, it gets a pipe as each stream. Forks in the background may run after an event or service has been processed when udev is detached from pipe. As a result process fails quietly if any message is written. To prevent from it, each fork has to close all parent streams. Leave stderr and stdout opened only for debug purposes. Unify it across all forks. Introduce other descriptors detection by scanning /proc/self/fd directory. Add generic method for managing systemd services. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
* imsm: limit support to first NVMe namespaceMariusz Tkaczyk2020-11-263-1/+42
| | | | | | Due to metadata limitations NVMe multinamespace support has to be removed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
* Monitor: don't use default modes when creating a fileMariusz Tkaczyk2020-11-261-5/+12
| | | | | | | Replace fopen() calls by open() with creation mode directly specified. This fixes the potential security issue. Use octal values instead masks. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* imsm: remove redundant calls to imsm_get_mapMariusz Tkaczyk2020-11-261-2/+0
| | | | | | MAP_0 is gotten and the beginning, there is no need to get it again. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* imsm: update num_data_stripes according to dev_sizeMariusz Tkaczyk2020-11-261-6/+78
| | | | | | | | | | | | | | | | If array was created in UEFI there is possibility that member size is not rounded to 1MB. After any size reconfiguration it will be rounded down to 1MB per each member but the old component size will remain in metadata. During reshape old array size is calculated from component size because dev_size is not a part of map and is bumped to new value quickly. It may result in size mismatch if array is assembled during reshape. If difference in calculated size and dev_size is observed try to fix it. num_data_stripes value can be safety updated to smaller value if array doesn't occuppy whole reserved component space. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Create.c: close mdfd and generate ueventMariusz Tkaczyk2020-11-261-5/+2
| | | | | | | | | During mdfd closing change event is not generated because open() is called before start watching mddevice by udev. Device is ready at this stage. Unblock device, close fd and generate event to give a chance next layers to work. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Detail: fix segfault during IMSM raid creationLidong Zhong2020-11-261-1/+1
| | | | | | | | | | | It can be reproduced with non IMSM hardware and IMSM_NO_PLATFORM environmental variable set. The array state is inactive when creating an IMSM container. And the structure info is NULL because load_super() always fails since no intel HBA information could be obtained. Signed-off-by: Lidong Zhong <lidong.zhong@suse.com> Reported-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Fixes: 64bf4dff3430 (Detail: show correct raid level when the array is inactive)
* Super1: allow RAID0 layout setting to be removed.NeilBrown2020-10-144-5/+34
| | | | | | | | | | | | | | | | Once the RAID0 layout has been set, the RAID0 array cannot be assembled on an older kernel which doesn't understand layouts. This is an intentional safety feature, but sometimes people need the ability to roll-back to a previously working configuration. So add "--update=layout-unspecified" to remove RAID0 layout information from the superblock. Running "--assemble --update=layout-unspecified" will cause the assembly the fail when run on a newer kernel, but will allow it to work on an older kernel. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Check if other Monitor instance running before fork.Blazej Kucman2020-10-141-16/+28
| | | | | | | | Make error message visible to the user. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdmonitor: set small delay onceBlazej Kucman2020-10-143-5/+29
| | | | | | | | | If mdmonitor is awakened by event, set small delay once to deal with udev and mdadm. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: stop notifing about containers.Mariusz Tkaczyk2020-10-141-3/+16
| | | | | | | | | | Stop reporting any events from container but still track them, it is important for spare migration. Stop mdmonitor if no redundant array is presented in mdstat. There is nothing to follow. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: refresh mdstat fd after selectMariusz Tkaczyk2020-10-142-5/+5
| | | | | | | | | | | | | After 52209d6ee118 ("Monitor: release /proc/mdstat fd when no arrays present") mdstat fd is closed if mdstat is empty or cannot be opened. It causes that monitor is not able to select on mdstat. Select doesn't fail because it gets valid descriptor to a different resource. As a result any new event will be unnoticed until timeout (delay). Refresh mdstat after wake up, don't poll on wrong resource. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Don't create bitmap for raid5 with journal diskXiao Ni2020-10-141-0/+1
| | | | | | | | Journal disk and bitmap can't exist at the same time. It needs to check if the raid has a journal disk when creating bitmap. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Detail: show correct raid level when the array is inactiveLidong Zhong2020-10-141-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the raid level in the output of `mdadm -D /dev/mdX` is misleading when the array is in inactive state. Here is a testcase for introduction. 1\ creating a raid1 device with two disks. Specify a different hostname rather than the real one for later verfication. node1:~ # mdadm --create /dev/md0 --homehost TESTARRAY -o -l 1 -n 2 /dev/sdb /dev/sdc 2\ remove one of the devices and reboot 3\ show the detail of raid1 device node1:~ # mdadm -D /dev/md127 /dev/md127: Version : 1.2 Raid Level : raid0 Total Devices : 1 Persistence : Superblock is persistent State : inactive Working Devices : 1 You can see that the "Raid Level" in /dev/md127 is raid0 now. After step 2\ is done, the degraded raid1 device is recognized as a "foreign" array in 64-md-raid-assembly.rules. And thus the timer to activate the raid1 device is not triggered. The array level returned from GET_ARRAY_INFO ioctl is 0. And the string shown for "Raid Level" is str = map_num(pers, array.level); And the definition of pers is mapping_t pers[] = { { "linear", LEVEL_LINEAR}, { "raid0", 0}, { "0", 0} ... So the misleading "raid0" is shown in this testcase. Changelog: v1: don't show "Raid Level" when array is inactive Signed-off-by: Lidong Zhong <lidong.zhong@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* manual: update --examine-badblocksMariusz Tkaczyk2020-08-071-2/+4
| | | | | | | IMSM also supports it. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/md.4: update path to in-kernel-tree documentationWinston Weinert2020-08-071-1/+1
| | | | | | | | | Documentation/md.txt was renamed to Documentation/admin-guide/md.rst in linux commit 9d85025b0418163fae079c9ba8f8445212de8568 (Oct 26, 2016). Signed-off-by: Winston Weinert <winston@ml1.net> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Specify nodes number when updating cluster nodesXiao Ni2020-08-071-0/+5
| | | | | | | | | | | Now it allows updating cluster nodes without specify --nodes. It can write superblock with zero nodes. It can break the current cluster. Add this check to avoid this problem. v2: It needs check c.update first to avoid NULL pointer reference v3: Wol points the typo error Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/Grow: prevent md's fd from being occupied during delayed timeallenpeng2020-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we start reshaping on md which shares sub-devices with another resyncing md, it may be forced to wait for others to complete. mdadm occupies the md's fd during this time, which causes the md can not be stopped and the filesystem can not be mounted on the md. We can close md's fd earlier to solve this problem. Reproducible Steps: 1. create two partitions on sda, sdb, sdc, sdd 2. create raid1 with sda1, sdb1 mdadm -C /dev/md1 --assume-clean -l1 -n2 /dev/sda1 /dev/sdb1 3. create raid5 with sda2, sdb2, sdc2 mdadm -C /dev/md2 --assume-clean -l5 -n3 /dev/sda2 /dev/sdb2 /dev/sdc2 4. start resync at md1 echo repair > /sys/block/md1/md/sync_action 5. reshape raid5 to raid6 mdadm -a /dev/md2 /dev/sdd2 mdadm --grow /dev/md2 -n4 -l6 --backup-file=/root/md2-backup Now mdadm is occupying the fd of md2, causing md2 unable to be stopped 6.Try to stop md2, an error message shows mdadm -S /dev/md2 mdadm: Cannot get exclusive access to /dev/md3:Perhaps a running process, mounted filesystem or active volume group? Reviewed-by: Alex Wu <alexwu@synology.com> Reviewed-by: BingJing Chang <bingjingc@synology.com> Reviewed-by: Danny Shih <dannyshih@synology.com> Signed-off-by: ChangSyun Peng <allenpeng@synology.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Update link to Intel page for IMSMJes Sorensen2020-06-121-1/+1
| | | | | | The old design page is gone, so update to the current overview page. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Use more secure HTTPS URLsPaul Menzel2020-06-126-9/+9
| | | | | | | | | | | | | | All URLs in the source are available over HTTPS, so convert all URLs to HTTPS with the command below. git grep -l 'http://' | xargs sed -i 's,http://,https://,g' Revert the changes to announcement files `ANNOUNCE-*` as requested by the maintainer. Cc: linux-raid@vger.kernel.org Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Detect too-small device: error rather than underflow/crashDavid Favro2020-06-051-5/+14
| | | | | | | | | | | | | | For 1.x metadata, when the user requested creation of an array on component devices that were too small even to hold the superblock, an undetected integer wraparound (underflow) resulted in an enormous computed size which resulted in various follow-on errors such as floating-point exception. This patch detects this condition, prints a reasonable diagnostic message, and refuses to continue. Signed-off-by: David Favro <dfavro@meta-dynamic.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Block overwriting existing links while manual assemblyKinga Tanska2020-06-051-0/+4
| | | | | | | | Manual assembly with existing link caused overwriting this link. Add checking link and block this situation. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* restripe: fix ignoring return value of ‘read’ and lseekGuoqing Jiang2020-05-191-2/+10
| | | | | | | | | | | | | | | | | Got below error when run "make everything". restripe.c: In function ‘test_stripes’: restripe.c:870:4: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result] read(source[i], stripes[i], chunk_size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix it by check the return value of ‘read’, and free memory in the failure case. And check the return value of lseek as well per Jes's comment. Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Include count for \0 character when using strncpy to implement strdup.Jes Sorensen2020-05-191-1/+1
| | | | | | | | | | | We have to include the \0 character in the length when copying a string with strncpy() for which length was found with strlen(). Otherwise the destination will not get null terminated - except that we explicitly zeroed it out earlier. This quiets down the compiler's warnings. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* uuid.c: split uuid stuffs from util.cGuoqing Jiang2020-05-193-90/+115
| | | | | | | | | | | | | | | | | | | | Currently, 'make raid6check' is build broken since commit b06815989 ("mdadm: load default sysfs attributes after assemblation"). /usr/bin/ld: sysfs.o: in function `sysfsline': sysfs.c:(.text+0x2707): undefined reference to `parse_uuid' /usr/bin/ld: sysfs.c:(.text+0x271a): undefined reference to `uuid_zero' /usr/bin/ld: sysfs.c:(.text+0x2721): undefined reference to `uuid_zero' Apparently, the compile of mdadm or raid6check are coupled with uuid functions inside util.c. However, we can't just add util.o to CHECK_OBJS which raid6check is needed, because it caused other worse problems. So, let's introduce a uuid.c file which is indenpended file to fix the problem, all the contents are splitted from util.c. Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Makefile: add EXTRAVERSION supportTkaczyk Mariusz2020-05-152-2/+6
| | | | | | | | | Add optional EXTRAVERSION parameter to Makefile and allow to mark version by user friendly label. It might be useful when creating custom spins of mdadm, or labeling some instance in between major releases. Signed-off-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdcheck: Log when doneDonald Buczek2020-05-141-0/+2
| | | | | | | | | | | | | | | | | | Currently mdcheck (when called with `--duration`) logs only the beginning of the check, the pausing and the continuation but not the completion. So, log the completion, too, so that it can be determined how long the raid check took. 2020-05-08T18:00:02+02:00 deadpool root: mdcheck start checking /dev/md0 2020-05-08T18:00:02+02:00 deadpool root: mdcheck start checking /dev/md1 2020-05-09T15:32:04+02:00 deadpool root: mdcheck finished checking /dev/md1 2020-05-09T17:38:04+02:00 deadpool root: mdcheck finished checking /dev/md0 Cc: linux-raid@vger.kernel.org Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Assemble.c: respect force flag.Mariusz Tkaczyk2020-05-141-13/+38
| | | | | | | | | | | | | | | | If the array is dirty handler will set resync_start to 0 to inform kernel that resync is needed. RWH affects only raid456 module, for other levels array will be started even array is degraded and resync cannot be performed. Force is really meaningful for raid456. If array is degraded and resync is requested, kernel will reject an attempt to start the array. To respect force, it has to be marked as clean (this will be done for each array without PPL) and remove the resync request (only for raid 456). Data corruption may occur so proper warning is added. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* clean up meaning of small typoNigel Croxon2020-05-051-1/+1
| | | | | | | Clean up the typo which leads to wrong understanding. Signed-off-by: Nigel Croxon <ncroxon@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Assemble: print error message if mdadm fails assembling with --uuid optionGioh Kim2020-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mdadm tries to assemble one working device and one zeroed-out device, it failed but print successful message because there is --uuid option. Following script always reproduce it. dd if=/dev/zero of=/dev/ram0 oflag=direct dd if=/dev/zero of=/dev/ram1 oflag=direct ./mdadm -C /dev/md111 -e 1.2 --uuid="12345678:12345678:12345678:12345678" \ -l1 -n2 /dev/ram0 /dev/ram1 ./mdadm -S /dev/md111 dd if=/dev/zero of=/dev/ram1 oflag=direct ./mdadm -A /dev/md111 --uuid="12345678:12345678:12345678:12345678" \ /dev/ram0 /dev/ram1 Following is message from mdadm. mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000) mdadm: no RAID superblock on /dev/ram1 mdadm: /dev/md111 assembled from 1 drive - need all 2 to start it (use --run to insist). The mdadm say that it assembled but mdadm does not create /dev/md111. The message is wrong. After applying this patch, mdadm reports error correctly as following. mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000) mdadm: no RAID superblock on /dev/ram1 mdadm: /dev/ram1 has no superblock - assembly aborted Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Manage, imsm: Write metadata before addTkaczyk Mariusz2020-04-272-28/+44
| | | | | | | | | | | | | | | | | | | | | | New drive in container always appears as spare. Manager is able to handle that, and queues appropriative update to monitor. No update from mdadm side has to be processed, just insert the drive and ping the mdmon. Metadata has to be written if no mdmon is running (case for Raid0 or container without arrays). If bare drive is added very early on startup (by custom bare rule), there is possiblity that mdmon was not restarted after switch root. Old one is not able to handle new drive. New one fails because there is drive without metadata in container and metadata cannot be loaded. To prevent this, write spare metadata before adding device to container. Mdmon will overwrite it (same case as spare migration, if drive appears it writes the most recent metadata). Metadata has to be written only on new drive before sysfs_add_disk(), don't race with mdmon if running. Signed-off-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Detail: adding sync status for cluster deviceLidong Zhong2020-04-273-4/+10
| | | | | | | | | | | | | | | | | | | On the node with /proc/mdstat is Personalities : [raid1] md0 : active raid1 sdb[4] sdc[3] sdd[2] 1046528 blocks super 1.2 [3/2] [UU_] recover=REMOTE bitmap: 1/1 pages [4KB], 65536KB chunk Let's change the 'State' of 'mdadm -Q -D' accordingly State : clean, degraded With this patch, it will be State : clean, degraded, recovering (REMOTE) Signed-off-by: Lidong Zhong <lidong.zhong@suse.com> Acked-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: improve check_one_sharer() for checking duplicated processColy Li2020-04-271-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running mdadm monitor with scan mode, only one autorebuild process is allowed. check_one_sharer() checks duplicated process by following steps, 1) Read autorebuild.pid file, - if file does not exist, no duplicated process, go to 3). - if file exists, continue to next step. 2) Read pid number from autorebuild.pid file, then check procfs pid directory /proc/<PID>, - if the directory does not exist, no duplicated process, go to 3) - if the directory exists, print error message for duplicated process and exit this mdadm. 3) Write current pid into autorebuild.pid file, continue to monitor in scan mode. The problem for the above step 2) is, if after system reboots and another different process happens to have exact same pid number which autorebuild.pid file records, check_one_sharer() will treat it as a duplicated mdadm process and returns error with message "Only one autorebuild process allowed in scan mode, aborting". This patch tries to fix the above same-pid-but-different-process issue by one more step to check the process command name, 1) Read autorebuild.pid file - if file does not exist, no duplicated process, go to 4). - if file exists, continue to next step. 2) Read pid number from autorebuild.pid file, then check procfs file comm with the specific pid directory /proc/<PID>/comm - if the file does not exit, it means the directory /proc/<PID> does not exist, go to 4) - if the file exits, continue next step 3) Read process command name from /proc/<PIC>/comm, compare the command name with "mdadm" process name, - if not equal, no duplicated process, goto 4) - if strings are equal, print error message for duplicated process and exit this mdadm. 4) Write current pid into autorebuild.pid file, continue to monitor in scan mode. Now check_one_sharer() returns error for duplicated process only when the recorded pid from autorebuild.pid exists, and the process has exact same command name as "mdadm". Reported-by: Shinkichi Yamazaki <shinkichi.yamazaki@suse.com> Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* udev: Ignore change event for imsmMariusz Tkaczyk2020-04-271-1/+1
| | | | | | | | | | | | | When adding a device to a container mdadm has to close its file descriptor before sysfs_add_disk(). This generates change event. There is race possibility because metadata is already written and other -I process can place drive differently. As a result device can be added to two containers simultaneously. From IMSM perspective there is no need to react for change event. IMSM doesn't support stacked devices. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: show Subarray and Volume ID in --examine outputArtur Paszkiewicz2020-03-171-0/+3
| | | | | | | | Show the index of the subarray as 'Subarray' and the value of the my_vol_raid_dev_num field as 'Volume ID'. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: support the Array Creation Time field in metadataArtur Paszkiewicz2020-03-171-2/+9
| | | | | | | Also present its value in --examine and --examine --export. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Detail: show correct bitmap info for cluster raid deviceLidong Zhong2020-03-161-1/+3
| | | | | Signed-off-by: Lidong Zhong <lidong.zhong@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: Correct minimal device size.Blazej Kucman2020-03-121-1/+4
| | | | | | | Check if given size of member drive is not less than 1 MibiByte. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: Remove --dump/--restore implementationBlazej Kucman2020-02-241-56/+0
| | | | | | | | Functionalities --dump and --restore are not supported. Remove dead code from imsm. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: pass subarray id to kill_subarray functionBlazej Kucman2020-02-244-8/+8
| | | | | | | | | | | After patch b6180160f ("imsm: save current_vol number") current_vol for imsm is not set and kill_subarray() cannot determine which volume has to be deleted. Volume has to be passed as "subarray_id". The parameter affects only IMSM metadata. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Remove the legacy whitespaceXiao Ni2020-02-243-3/+3
| | | | | | | | | The whitespace between Environment= and the true value causes confusion. To avoid confusing other people in future, remove the whitespace to keep it a simple, unambiguous syntax Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm.8: add note information for raid0 growing operationColy Li2020-02-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When growing a raid0 device, if the new component disk size is not big enough, the grow operation may fail due to lack of backup space. The minimum backup space should be larger than: LCM(old, new) * chunk-size * 2 where LCM() is the least common multiple of the old and new count of component disks, and "* 2" comes from the fact that mdadm refuses to use more than half of a spare device for backup space. There are users reporting such failure when they grew a raid0 array with small component disk. Neil Brown points out this is not a bug and how the failure comes. This patch adds note information into mdadm(8) man page in the Notes part of GROW MODE section to explain the minimum size requirement of new component disk size or external backup size. Reviewed-by: Petr Vorel <pvorel@suse.cz> Cc: NeilBrown <neilb@suse.de> Cc: Jes Sorensen <jsorensen@fb.com> Cc: Paul Menzel <pmenzel@molgen.mpg.de> Cc: Wols Lists <antlists@youngman.org.uk> Cc: Nix <nix@esperi.org.uk> Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: fill working_disks according to metadata.Blazej Kucman2020-01-212-6/+8
| | | | | | | | | | | | Imsm tracks as "working_disk" each visible drive. Assemble routine expects that the value will return count of active member drives recorded in metadata. As a side effect "--no-degraded" doesn't work correctly for imsm. Align this field to others. Added check, if the option --no-degraded is called with --scan. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Add support for TebibytesKinga Tanska2020-01-212-24/+43
| | | | | | | | | Adding support for Tebibytes enables display size of volumes in Tebibytes and Terabytes when they are bigger than 2048 GiB (or GB). Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>