Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-11-01 14:04:41 +1100
committerNeilBrown <neilb@suse.com>2018-11-01 14:04:52 +1100
commit5f808572f4ccad5e1d8ed9b896a74133ecdf87b9 (patch)
tree46b72ab9da68ba75de0989977a2653a40f340df3
parent76815af2b903dcd25688fd980a52c5384c273d3d (diff)
badblocks: fix wrong return value in badblocks_set if badblocks
are disabled (git-fixes).
-rw-r--r--patches.fixes/badblocks-fix-wrong-return-value-in-badblocks_set-if.patch35
-rw-r--r--series.conf1
2 files changed, 36 insertions, 0 deletions
diff --git a/patches.fixes/badblocks-fix-wrong-return-value-in-badblocks_set-if.patch b/patches.fixes/badblocks-fix-wrong-return-value-in-badblocks_set-if.patch
new file mode 100644
index 0000000000..fef348c457
--- /dev/null
+++ b/patches.fixes/badblocks-fix-wrong-return-value-in-badblocks_set-if.patch
@@ -0,0 +1,35 @@
+From: Liu Bo <bo.li.liu@oracle.com>
+Date: Fri, 3 Nov 2017 11:24:44 -0600
+Subject: [PATCH] badblocks: fix wrong return value in badblocks_set if
+ badblocks are disabled
+Git-commit: 39b4954c0a1556f8f7f1fdcf59a227117fcd8a0b
+Patch-mainline: v4.15
+References: git-fixes
+
+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>
+
+---
+ block/badblocks.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/block/badblocks.c
++++ b/block/badblocks.c
+@@ -178,7 +178,7 @@ int badblocks_set(struct badblocks *bb,
+
+ if (bb->shift < 0)
+ /* badblocks are disabled */
+- return 0;
++ return 1;
+
+ if (bb->shift) {
+ /* round the start down, and the end up */
diff --git a/series.conf b/series.conf
index f5ab31bf6c..0bf8138695 100644
--- a/series.conf
+++ b/series.conf
@@ -8336,6 +8336,7 @@
patches.suse/0071-md-remove-redundant-variable-q.patch
patches.drivers/0005-md-cluster-update-document-for-raid10.patch
patches.suse/0072-md-don-t-check-MD_SB_CHANGE_CLEAN-in-md_allow_write.patch
+ patches.fixes/badblocks-fix-wrong-return-value-in-badblocks_set-if.patch
patches.suse/0073-md-be-cautious-about-using-curr_resync_completed-for.patch
patches.suse/0074-md-bitmap-clear-BITMAP_WRITE_ERROR-bit-before-writin.patch
patches.suse/0075-md-release-allocated-bitset-sync_set.patch