Skip to contentSkip to conversation

Kill: fix when zeroing busy devices.

PATCH In review Artur Wojcik 3 participants 3 messages Jan 28, 2010 – Jan 29, 2010 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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).

---
 Kill.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Kill.c +1 -1
index 63442a6..a65b865 100644
@@ -46,7 +46,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
 			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);
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Artur Wojcik

mdadm should not wait indefinitely when it trys to reset superblock on device which is busy (cannot be opened).

---
 Kill.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Kill.c +0 -0
index 63442a6..a65b865 100644

Kill.c int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl) · line 52

Quoted 8 lines
Kill.c +1 -1
@@ -46,7 +46,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
 			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);

Jup.

BTW: Mind to kill the close(fd) as well (as fd is negative) while we're at it? A comment that explains the meaning of the return value would also be nice.

Thanks
Andre

Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe
#2 lore raw
Quoted 3 lines · On Thu, 28 Jan 2010 17:31:57 +0100 Andre Noll <[email protected]> wrote:
Quoted 2 lines · Artur Wojcik

mdadm should not wait indefinitely when it trys to reset superblock on device which is busy (cannot be opened).

Thanks.

Quoted 22 lines
Quoted 11 lines
---
 Kill.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Kill.c +0 -0
index 63442a6..a65b865 100644

Kill.c int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl) · line 52

Quoted 8 lines
Kill.c +1 -1
@@ -46,7 +46,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
 			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);

Jup.

Quoted 5 lines

BTW: Mind to kill the close(fd) as well (as fd is negative) while we're at it? A comment that explains the meaning of the return value would also be nice.

Done and done.

I really don't know why the loop in mdadm.c cared about the different possible return values - I cannot see any justification for it.

Thanks,
NeilBrown