diff options
author | Shaohua Li <shli@kernel.org> | 2013-10-19 10:51:42 +0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-10-24 06:00:24 +0400 |
commit | d47648fcf0611812286f68131b40251c6fa54f5e (patch) | |
tree | 913370efae899bbcfda8364d569d1e74f392eb88 | |
parent | 37c61ff31e9b5e3fcf3cc6579f5c68f6ad40c4b1 (diff) | |
download | linux-d47648fcf0611812286f68131b40251c6fa54f5e.tar.xz |
raid5: avoid finding "discard" stripe
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+.
Cc: <stable@vger.kernel.org> (3.7+)
Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/raid5.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 302d7cd2076c..f8b906843926 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2922,6 +2922,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); |