[PATCH] Manage.c: Try to get EXCL access more times while stopping the array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If mdadm does not get EXCL access to the array
and it is managed by mdmon, it should flush monitor
and try again, because there still can be (for example)
a process that is finishing aborting reshape.
If this fails couple of times, mdadm should stop trying,
print an error and abort stopping the array.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@xxxxxxxxx>
---
 Manage.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Manage.c b/Manage.c
index 6267c0c..f557662 100644
--- a/Manage.c
+++ b/Manage.c
@@ -222,7 +222,15 @@ int Manage_runstop(char *devname, int fd, int runstop,
 		 * to stop is probably a bad idea.
 		 */
 		close(fd);
-		fd = open(devname, O_RDONLY|O_EXCL);
+		count = 10;
+		while (((fd = open(devname, O_RDONLY|O_EXCL)) < 0 ||
+				strcmp(fd2devnm(fd), devnm) != 0)
+				&& mdmon_running(devnm) && count) {
+				if (fd >= 0)
+					close(fd);
+				flush_mdmon(devnm);
+				count--;
+		}
 		if (fd < 0 || strcmp(fd2devnm(fd), devnm) != 0) {
 			if (fd >= 0)
 				close(fd);

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux