mdadm.c: Fix error handling for --zero-superblock
When Kill() cannot open device or find superblock it return the same error and mdadm ignores it. Change error handling in Kill() function. Return error if device is busy, ignore it only when superblock doesn't exist- assume that metadata is zeroed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
parent
a882c7b1ec
commit
29d7f182a5
5
Kill.c
5
Kill.c
|
@ -37,7 +37,8 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
|
|||
* 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.
|
||||
* 2 - failed to open the device.
|
||||
* 4 - failed to find a superblock.
|
||||
*/
|
||||
|
||||
int fd, rv = 0;
|
||||
|
@ -57,7 +58,7 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl)
|
|||
if (verbose >= 0)
|
||||
pr_err("Unrecognised md component device - %s\n", dev);
|
||||
close(fd);
|
||||
return 2;
|
||||
return 4;
|
||||
}
|
||||
st->ignore_hw_compat = 1;
|
||||
rv = st->ss->load_super(st, fd, dev);
|
||||
|
|
Loading…
Reference in New Issue