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:06:31 +1100
commit6d8bf1dc9761777d8312056a0d3f3f6cea50a5c3 (patch)
tree38604d60e59e2e9d421e565ed02a3c70bbd68c0d
parent1d45c863d099995e5bbc2a14ec89549f093f5de8 (diff)
RAID10 BUG_ON in raise_barrier when force is true and
conf->barrier is 0 (git-fixes).
-rw-r--r--patches.fixes/RAID10-BUG_ON-in-raise_barrier-when-force-is-true-an.patch55
-rw-r--r--series.conf1
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.fixes/RAID10-BUG_ON-in-raise_barrier-when-force-is-true-an.patch b/patches.fixes/RAID10-BUG_ON-in-raise_barrier-when-force-is-true-an.patch
new file mode 100644
index 0000000000..675f6ecf94
--- /dev/null
+++ b/patches.fixes/RAID10-BUG_ON-in-raise_barrier-when-force-is-true-an.patch
@@ -0,0 +1,55 @@
+From: Xiao Ni <xni@redhat.com>
+Date: Thu, 30 Aug 2018 15:57:09 +0800
+Subject: [PATCH] RAID10 BUG_ON in raise_barrier when force is true and
+ conf->barrier is 0
+Git-commit: 1d0ffd264204eba1861865560f1f7f7a92919384
+Patch-mainline: v4.19
+References: git-fixes
+
+In raid10 reshape_request it gets max_sectors in read_balance. If the underlayer disks
+have bad blocks, the max_sectors is less than last. It will call goto read_more many
+times. It calls raise_barrier(conf, sectors_done != 0) every time. In this condition
+sectors_done is not 0. So the value passed to the argument force of raise_barrier is
+true.
+
+In raise_barrier it checks conf->barrier when force is true. If force is true and
+conf->barrier is 0, it panic. In this case reshape_request submits bio to under layer
+disks. And in the callback function of the bio it calls lower_barrier. If the bio
+finishes before calling raise_barrier again, it can trigger the BUG_ON.
+
+Add one pair of raise_barrier/lower_barrier to fix this bug.
+
+Signed-off-by: Xiao Ni <xni@redhat.com>
+Suggested-by: Neil Brown <neilb@suse.com>
+Signed-off-by: Shaohua Li <shli@fb.com>
+Acked-by: NeilBrown <neilb@suse.com>
+
+---
+ drivers/md/raid10.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/md/raid10.c
++++ b/drivers/md/raid10.c
+@@ -4566,11 +4566,12 @@ static sector_t reshape_request(struct m
+ allow_barrier(conf);
+ }
+
++ raise_barrier(conf, 0);
+ read_more:
+ /* Now schedule reads for blocks from sector_nr to last */
+ r10_bio = raid10_alloc_init_r10buf(conf);
+ r10_bio->state = 0;
+- raise_barrier(conf, sectors_done != 0);
++ raise_barrier(conf, 1);
+ atomic_set(&r10_bio->remaining, 0);
+ r10_bio->mddev = mddev;
+ r10_bio->sector = sector_nr;
+@@ -4666,6 +4667,8 @@ read_more:
+ if (sector_nr <= last)
+ goto read_more;
+
++ lower_barrier(conf);
++
+ /* Now that we have done the whole section we can
+ * update reshape_progress
+ */
diff --git a/series.conf b/series.conf
index 605290ea21..211d70f348 100644
--- a/series.conf
+++ b/series.conf
@@ -17956,6 +17956,7 @@
patches.arch/acpi-bus-only-call-dmi_check_system-on-x86.patch
patches.fixes/ceph-avoid-a-use-after-free-in-ceph_destroy_options.patch
patches.fixes/md-raid5-cache-disable-reshape-completely.patch
+ patches.fixes/RAID10-BUG_ON-in-raise_barrier-when-force-is-true-an.patch
patches.suse/0001-md-cluster-release-RESYNC-lock-after-the-last-resync.patch
patches.drivers/i2c-uniphier-issue-STOP-only-for-last-message-or-I2C.patch
patches.drivers/i2c-uniphier-f-issue-STOP-only-for-last-message-or-I.patch