65 lines
2.1 KiB
Diff
65 lines
2.1 KiB
Diff
From 77b72fa828132a35c8b2e08d3fb07eea80b11895 Mon Sep 17 00:00:00 2001
|
|
From: allenpeng <allenpeng@synology.com>
|
|
Date: Fri, 12 Jun 2020 17:00:39 +0800
|
|
Subject: [PATCH 086/108] mdadm/Grow: prevent md's fd from being occupied
|
|
during delayed time
|
|
|
|
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>
|
|
---
|
|
Grow.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/Grow.c b/Grow.c
|
|
index 764374f..57db7d4 100644
|
|
--- a/Grow.c
|
|
+++ b/Grow.c
|
|
@@ -3517,6 +3517,7 @@ started:
|
|
return 0;
|
|
}
|
|
|
|
+ close(fd);
|
|
/* Now we just need to kick off the reshape and watch, while
|
|
* handling backups of the data...
|
|
* This is all done by a forked background process.
|
|
@@ -3569,7 +3570,6 @@ started:
|
|
mdstat_wait(30 - (delayed-1) * 25);
|
|
} while (delayed);
|
|
mdstat_close();
|
|
- close(fd);
|
|
if (check_env("MDADM_GROW_VERIFY"))
|
|
fd = open(devname, O_RDONLY | O_DIRECT);
|
|
else
|
|
--
|
|
2.7.5
|
|
|