mdadm: Expose Kill() return codes to user
PATCH 1/1 mdadm: Expose Kill() return codes to user
In misc_list(), case KillOpt, the return values from the Kill() function are saved, but soon after cleared with a bitwise OR assignment. Expose these return values to the user, indicating success of the zeroing operation or an error value to accompany the error message printed to the console.
Before:
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 0
After:
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 2
--- mdadm.c | 1 - 1 file changed, 1 deletion(-)
mdadm.c +0 -1
@@ -1937,7 +1937,6 @@ static int misc_list(struct mddev_dev *devlist, rv |=Kill (dv->devname,NULL , c->force, v,0 ); v =-1 ; }while (rv ==0 ); - rv &= ~2 ; }continue ;case 'Q' :
Signature · 1 line
2.7.5
Jes Sorensen
AppliedQuoted 17 lines · John Pittman
In
misc_list(), case KillOpt, the return values from theKill()function are saved, but soon after cleared with a bitwise OR assignment. Expose these return values to the user, indicating success of the zeroing operation or an error value to accompany the error message printed to the console.Before:
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 0After:
Quoted 8 lines
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 2Signed-off-by John Pittman <[email protected]>
Seems reasonable to me!
Applied!
Thanks,
Jes
Terribly sorry Jes, got pulled away and did not get back. Unfortunately this patch is incorrect. Please revert. It causes the return value of even a successful wipe to be 2. If I can figure out why, I will re-submit. Apologies again.
Quoted 34 lines · Jes Sorensen
Quoted 17 lines · John Pittman
In
misc_list(), case KillOpt, the return values from theKill()function are saved, but soon after cleared with a bitwise OR assignment. Expose these return values to the user, indicating success of the zeroing operation or an error value to accompany the error message printed to the console.Before:
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 0After:
Quoted 8 lines
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 2Signed-off-by John Pittman <[email protected]>Seems reasonable to me!
Applied!
Thanks,
Jes
Quoted 4 lines · John Pittman
Terribly sorry Jes, got pulled away and did not get back. Unfortunately this patch is incorrect. Please revert. It causes the return value of even a successful wipe to be 2. If I can figure out why, I will re-submit. Apologies again.
Good thing I hadn't pushed it - gone!
Jes
Quoted 35 lines · Jes Sorensen
Quoted 34 lines · John Pittman
Quoted 17 lines
In
misc_list(), case KillOpt, the return values from theKill()function are saved, but soon after cleared with a bitwise OR assignment. Expose these return values to the user, indicating success of the zeroing operation or an error value to accompany the error message printed to the console.Before:
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 0After:
Quoted 8 lines
# mdadm -C /dev/md0 -l 1 -n 2 -e 1.2 /dev/sda /dev/sdb mdadm: array /dev/md0 started. # mdadm --zero-superblock /dev/sdb mdadm: Couldn't open /dev/sdb for write - not zeroing # echo $? 2Signed-off-by John Pittman <[email protected]>Seems reasonable to me!
Applied!
Thanks,
Jes