summaryrefslogtreecommitdiff
authorLiu Bo <bo.li.liu@oracle.com>2017-11-03 17:24:44 (GMT)
committer Greg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-20 09:07:29 (GMT)
commitcb0acb37010c216e4781224ad4ab4c12ca9cb5fe (patch)
tree9fe7b28e5a06e30f967aa3c5ec15a25c909faf0d
parentdcdca123814c5303f0e4d0fba67756d35bb0fd1f (diff)
downloadcommon-cb0acb37010c216e4781224ad4ab4c12ca9cb5fe.zip
common-cb0acb37010c216e4781224ad4ab4c12ca9cb5fe.tar.gz
common-cb0acb37010c216e4781224ad4ab4c12ca9cb5fe.tar.bz2
badblocks: fix wrong return value in badblocks_set if badblocks are disabled
[ Upstream commit 39b4954c0a1556f8f7f1fdcf59a227117fcd8a0b ] 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 9e0e252a048b ("badblocks: Add core badblock management code"). Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Acked-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat
-rw-r--r--block/badblocks.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/badblocks.c b/block/badblocks.c
index 6ebcef2..2fe6c11 100644
--- a/block/badblocks.c
+++ b/block/badblocks.c
@@ -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 */