]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
raid5: avoid finding "discard" stripe
authorShaohua Li <shli@kernel.org>
Sat, 19 Oct 2013 06:51:42 +0000 (14:51 +0800)
committerNeilBrown <neilb@suse.de>
Thu, 24 Oct 2013 02:00:24 +0000 (13:00 +1100)
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>
drivers/md/raid5.c

index 302d7cd2076c61ea557caf0f77c2ba3f4f6f8b79..f8b9068439267a3539d671e6e59ceb0b47b90547 100644 (file)
@@ -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);