summaryrefslogtreecommitdiffstats
path: root/Kill.c
diff options
context:
space:
mode:
authorArtur Wojcik <artur.wojcik@intel.com>2010-01-28 16:48:44 +0100
committerNeilBrown <neilb@suse.de>2010-01-29 10:53:24 +0100
commit4c619b292f7e6b69a817b96d2001ff8f10b7a6bd (patch)
treeac4edf277f9f185347da64fbfcbb392e4efc5378 /Kill.c
parentmapfile: fix locking. (diff)
downloadmdadm-4c619b292f7e6b69a817b96d2001ff8f10b7a6bd.tar.xz
mdadm-4c619b292f7e6b69a817b96d2001ff8f10b7a6bd.zip
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@systemlinux.org> Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Kill.c')
-rw-r--r--Kill.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Kill.c b/Kill.c
index 63442a62..e7389785 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);