aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-02-21 13:56:19 -0500
committerShaohua Li <shli@fb.com>2017-02-23 14:59:43 -0500
commitaff8da09f2381f0869faaf6637b0d892a3ee99ed (patch)
tree5cebc473d84c008f75c5f7980c432f02a7a9fb94
parentd939cdfde34f50b95254b375f498447c82190b3e (diff)
md/raid1: handle flush request correctly
I got a warning triggered in align_to_barrier_unit_end. It's a flush request so sectors == 0. The flush request happens to work well without the new barrier patch, but we'd better handle it explictly. Cc: NeilBrown <neilb@suse.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r--drivers/md/raid1.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 2e5e4805cbe1..8901f0c8c775 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1282,8 +1282,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio)
1282 unsigned long flags; 1282 unsigned long flags;
1283 const int op = bio_op(bio); 1283 const int op = bio_op(bio);
1284 const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); 1284 const unsigned long do_sync = (bio->bi_opf & REQ_SYNC);
1285 const unsigned long do_flush_fua = (bio->bi_opf & 1285 const unsigned long do_fua = (bio->bi_opf & REQ_FUA);
1286 (REQ_PREFLUSH | REQ_FUA));
1287 struct md_rdev *blocked_rdev; 1286 struct md_rdev *blocked_rdev;
1288 struct blk_plug_cb *cb; 1287 struct blk_plug_cb *cb;
1289 struct raid1_plug_cb *plug = NULL; 1288 struct raid1_plug_cb *plug = NULL;
@@ -1509,7 +1508,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio)
1509 conf->mirrors[i].rdev->data_offset); 1508 conf->mirrors[i].rdev->data_offset);
1510 mbio->bi_bdev = conf->mirrors[i].rdev->bdev; 1509 mbio->bi_bdev = conf->mirrors[i].rdev->bdev;
1511 mbio->bi_end_io = raid1_end_write_request; 1510 mbio->bi_end_io = raid1_end_write_request;
1512 bio_set_op_attrs(mbio, op, do_flush_fua | do_sync); 1511 bio_set_op_attrs(mbio, op, do_fua | do_sync);
1513 if (test_bit(FailFast, &conf->mirrors[i].rdev->flags) && 1512 if (test_bit(FailFast, &conf->mirrors[i].rdev->flags) &&
1514 !test_bit(WriteMostly, &conf->mirrors[i].rdev->flags) && 1513 !test_bit(WriteMostly, &conf->mirrors[i].rdev->flags) &&
1515 conf->raid_disks - mddev->degraded > 1) 1514 conf->raid_disks - mddev->degraded > 1)
@@ -1565,6 +1564,11 @@ static void raid1_make_request(struct mddev *mddev, struct bio *bio)
1565 struct bio *split; 1564 struct bio *split;
1566 sector_t sectors; 1565 sector_t sectors;
1567 1566
1567 if (unlikely(bio->bi_opf & REQ_PREFLUSH)) {
1568 md_flush_request(mddev, bio);
1569 return;
1570 }
1571
1568 /* if bio exceeds barrier unit boundary, split it */ 1572 /* if bio exceeds barrier unit boundary, split it */
1569 do { 1573 do {
1570 sectors = align_to_barrier_unit_end( 1574 sectors = align_to_barrier_unit_end(