diff options
-rw-r--r-- | drivers/md/raid1.c | 7 | ||||
-rw-r--r-- | drivers/md/raid10.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index c055b92d7eb5..851023e2ba5d 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) | |||
981 | while (bio) { /* submit pending writes */ | 981 | while (bio) { /* submit pending writes */ |
982 | struct bio *next = bio->bi_next; | 982 | struct bio *next = bio->bi_next; |
983 | bio->bi_next = NULL; | 983 | bio->bi_next = NULL; |
984 | generic_make_request(bio); | 984 | if (unlikely((bio->bi_rw & REQ_DISCARD) && |
985 | !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) | ||
986 | /* Just ignore it */ | ||
987 | bio_endio(bio, 0); | ||
988 | else | ||
989 | generic_make_request(bio); | ||
985 | bio = next; | 990 | bio = next; |
986 | } | 991 | } |
987 | kfree(plug); | 992 | kfree(plug); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index c35d912a7f9b..018741ba9310 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1133,7 +1133,12 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule) | |||
1133 | while (bio) { /* submit pending writes */ | 1133 | while (bio) { /* submit pending writes */ |
1134 | struct bio *next = bio->bi_next; | 1134 | struct bio *next = bio->bi_next; |
1135 | bio->bi_next = NULL; | 1135 | bio->bi_next = NULL; |
1136 | generic_make_request(bio); | 1136 | if (unlikely((bio->bi_rw & REQ_DISCARD) && |
1137 | !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) | ||
1138 | /* Just ignore it */ | ||
1139 | bio_endio(bio, 0); | ||
1140 | else | ||
1141 | generic_make_request(bio); | ||
1137 | bio = next; | 1142 | bio = next; |
1138 | } | 1143 | } |
1139 | kfree(plug); | 1144 | kfree(plug); |