Artur Wojcik: Kill: fix when zeroing busy devices.
Martin F. Krafft
madduck at alioth.debian.org
Mon May 24 09:20:36 UTC 2010
Module: mdadm
Branch: upstream
Commit: 4c619b292f7e6b69a817b96d2001ff8f10b7a6bd
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=4c619b292f7e6b69a817b96d2001ff8f10b7a6bd
Author: Artur Wojcik <artur.wojcik at intel.com>
Date: Thu Jan 28 16:48:44 2010 +0100
Kill: fix when zeroing busy devices.
mdadm should not wait indefinitely when it trys to reset
superblock on device which is busy (cannot be opened).
Acked-by: Andre Noll <maan at systemlinux.org>
Signed-off-by: Artur Wojcik <artur.wojcik at intel.com>
Signed-off-by: NeilBrown <neilb at suse.de>
---
Kill.c | 7 +++++--
mdadm.c | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Kill.c b/Kill.c
index 63442a6..e738978 100644
--- a/Kill.c
+++ b/Kill.c
@@ -34,6 +34,10 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
/*
* Nothing fancy about Kill. It just zeroes out a superblock
* Definitely not safe.
+ * Returns:
+ * 0 - a zero superblock was successfully written out
+ * 1 - failed to write the zero superblock
+ * 2 - failed to open the device or find a superblock.
*/
int fd, rv = 0;
@@ -45,8 +49,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
if (!quiet)
fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n",
dev);
- close(fd);
- return 1;
+ return 2;
}
if (st == NULL)
st = guess_super(fd);
diff --git a/mdadm.c b/mdadm.c
index d235b2a..be4fbf6 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1367,7 +1367,7 @@ int main(int argc, char *argv[])
do {
rv |= Kill(dv->devname, NULL, force, q, 0);
q = 1;
- } while ((rv & 2) == 0);
+ } while (rv == 0);
rv &= ~2;
}
continue;
More information about the pkg-mdadm-commits
mailing list