diff options
author | Nigel Croxon <ncroxon@redhat.com> | 2019-04-16 12:50:09 -0400 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2019-04-16 17:33:18 -0400 |
commit | b2176a1dfb518d870ee073445d27055fea64dfb8 (patch) | |
tree | 0d95541e3b7f29186b6a837a7746a294c59f62bb | |
parent | a25d8c327bb41742dbd59f8c545f59f3b9c39983 (diff) |
md/raid: raid5 preserve the writeback action after the parity check
The problem is that any 'uptodate' vs 'disks' check is not precise
in this path. Put a "WARN_ON(!test_bit(R5_UPTODATE, &dev->flags)" on the
device that might try to kick off writes and then skip the action.
Better to prevent the raid driver from taking unexpected action *and* keep
the system alive vs killing the machine with BUG_ON.
Note: fixed warning reported by kbuild test robot <lkp@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
-rw-r--r-- | drivers/md/raid5.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index b5742d07662d..7fde645d2e90 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4191,7 +4191,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, | |||
4191 | /* now write out any block on a failed drive, | 4191 | /* now write out any block on a failed drive, |
4192 | * or P or Q if they were recomputed | 4192 | * or P or Q if they were recomputed |
4193 | */ | 4193 | */ |
4194 | BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */ | 4194 | dev = NULL; |
4195 | if (s->failed == 2) { | 4195 | if (s->failed == 2) { |
4196 | dev = &sh->dev[s->failed_num[1]]; | 4196 | dev = &sh->dev[s->failed_num[1]]; |
4197 | s->locked++; | 4197 | s->locked++; |
@@ -4216,6 +4216,14 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, | |||
4216 | set_bit(R5_LOCKED, &dev->flags); | 4216 | set_bit(R5_LOCKED, &dev->flags); |
4217 | set_bit(R5_Wantwrite, &dev->flags); | 4217 | set_bit(R5_Wantwrite, &dev->flags); |
4218 | } | 4218 | } |
4219 | if (WARN_ONCE(dev && !test_bit(R5_UPTODATE, &dev->flags), | ||
4220 | "%s: disk%td not up to date\n", | ||
4221 | mdname(conf->mddev), | ||
4222 | dev - (struct r5dev *) &sh->dev)) { | ||
4223 | clear_bit(R5_LOCKED, &dev->flags); | ||
4224 | clear_bit(R5_Wantwrite, &dev->flags); | ||
4225 | s->locked--; | ||
4226 | } | ||
4219 | clear_bit(STRIPE_DEGRADED, &sh->state); | 4227 | clear_bit(STRIPE_DEGRADED, &sh->state); |
4220 | 4228 | ||
4221 | set_bit(STRIPE_INSYNC, &sh->state); | 4229 | set_bit(STRIPE_INSYNC, &sh->state); |