summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaohua Li <shli@kernel.org>2013-04-28 18:26:38 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-05-07 20:08:23 -0700
commit70167a15d829277ed1373973b9535c20025c772a (patch)
tree96f62076ece29aa74f55b6695580a2f437c5e868
parent9088a4100a97838270b44a7980ccbc822b17a85b (diff)
downloadlinux-stable-70167a15d829277ed1373973b9535c20025c772a.tar.gz
linux-stable-70167a15d829277ed1373973b9535c20025c772a.tar.bz2
linux-stable-70167a15d829277ed1373973b9535c20025c772a.zip
MD: ignore discard request for hard disks of hybid raid1/raid10 array
commit 32f9f570d04461a41bdcd5c1d93b41ebc5ce182a upstream. In SSD/hard disk hybid storage, discard request should be ignored for hard disk. We used to be doing this way, but the unplug path forgets it. This is suitable for stable tree since v3.6. Reported-and-tested-by: Markus <M4rkusXXL@web.de> Signed-off-by: Shaohua Li <shli@fusionio.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/md/raid1.c7
-rw-r--r--drivers/md/raid10.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index fd86b372692d..6af167f81090 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -981,7 +981,12 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
while (bio) { /* submit pending writes */
struct bio *next = bio->bi_next;
bio->bi_next = NULL;
- generic_make_request(bio);
+ if (unlikely((bio->bi_rw & REQ_DISCARD) &&
+ !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
+ /* Just ignore it */
+ bio_endio(bio, 0);
+ else
+ generic_make_request(bio);
bio = next;
}
kfree(plug);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index b3898d411493..61ab219e2d39 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1087,7 +1087,12 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
while (bio) { /* submit pending writes */
struct bio *next = bio->bi_next;
bio->bi_next = NULL;
- generic_make_request(bio);
+ if (unlikely((bio->bi_rw & REQ_DISCARD) &&
+ !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
+ /* Just ignore it */
+ bio_endio(bio, 0);
+ else
+ generic_make_request(bio);
bio = next;
}
kfree(plug);