[PATCH] Create.c: Try few more times to stop array after failed creation

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

 



Sometimes after failure in creation (exp. due to duplicate devices
in create command) newly created empty md array will not be stopped
due to openers>1 (create_mddev will not manage to drop lock).
In this case ioctl() will return error - this needs to be checked
and if occurs - sending STOP_ARRAY should be repeat after delay
to make sure that mddev is stopped correctly.

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

diff --git a/Create.c b/Create.c
index 330c5b4..7c8e53e 100644
--- a/Create.c
+++ b/Create.c
@@ -904,7 +904,12 @@ int Create(struct supertype *st, char *mddev,
 				if (st->ss->add_to_super(st, &inf->disk,
 							 fd, dv->devname,
 							 dv->data_offset)) {
-					ioctl(mdfd, STOP_ARRAY, NULL);
+					int count = 5;
+					while (count &&
+					       (ioctl(mdfd, STOP_ARRAY, NULL) < 0)) {
+						usleep(100000);
+						count--;
+					}
 					goto abort_locked;
 				}
 				st->ss->getinfo_super(st, inf, NULL);

--
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