提交 39b4954c 编写于 作者: L Liu Bo 提交者: Shaohua Li

badblocks: fix wrong return value in badblocks_set if badblocks are disabled

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
9e0e252a ("badblocks: Add core badblock management code").
Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
Acked-by: NGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: NShaohua Li <shli@fb.com>
上级 b90f6ff0
......@@ -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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册