Skip to content

Commit

Permalink
badblocks: fix wrong return value in badblocks_set if badblocks are d…
Browse files Browse the repository at this point in the history
…isabled

MD's rdev_set_badblocks() expects that badblocks_set() returns 1 if
badblocks are disabled, otherwise, rdev_set_badblocks() will record
superblock changes and return success in that case and md will fail to
report an IO error which it should.

This bug has existed since badblocks were introduced in commit
9e0e252 ("badblocks: Add core badblock management code").

Signed-off-by: Liu Bo <[email protected]>
Acked-by: Guoqing Jiang <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
  • Loading branch information
Liu Bo authored and shligit committed Nov 3, 2017
1 parent b90f6ff commit 39b4954
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/badblocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors,

if (bb->shift < 0)
/* badblocks are disabled */
return 0;
return 1;

if (bb->shift) {
/* round the start down, and the end up */
Expand Down

0 comments on commit 39b4954

Please sign in to comment.