summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShaohua Li <shli@kernel.org>2013-10-19 14:51:42 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-13 12:08:08 +0900
commit8aabed06e0f51f4a71540350bb62c79d2913c54b (patch)
tree64e6645e91b2327109131df4a3846ea570803421 /drivers
parentb2a097d602f04c485b73deee3476a502edae3ac9 (diff)
raid5: avoid finding "discard" stripe
commit d47648fcf0611812286f68131b40251c6fa54f5e upstream. SCSI discard will damage discard stripe bio setting, eg, some fields are changed. If the stripe is reused very soon, we have wrong bios setting. We remove discard stripe from hash list, so next time the strip will be fully initialized. Suitable for backport to 3.7+. Signed-off-by: Shaohua Li <shli@fusionio.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid5.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 4f40d8b4e512..d825059d00ce 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2812,6 +2812,14 @@ static void handle_stripe_clean_event(struct r5conf *conf,
}
/* now that discard is done we can proceed with any sync */
clear_bit(STRIPE_DISCARD, &sh->state);
+ /*
+ * SCSI discard will change some bio fields and the stripe has
+ * no updated data, so remove it from hash list and the stripe
+ * will be reinitialized
+ */
+ spin_lock_irq(&conf->device_lock);
+ remove_hash(sh);
+ spin_unlock_irq(&conf->device_lock);
if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state))
set_bit(STRIPE_HANDLE, &sh->state);