summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-02-21 10:56:19 -0800
committerShaohua Li <shli@fb.com>2017-02-23 11:59:43 -0800
commitaff8da09f2381f0869faaf6637b0d892a3ee99ed (patch)
tree5cebc473d84c008f75c5f7980c432f02a7a9fb94 /drivers/md/raid1.c
parentd939cdfde34f50b95254b375f498447c82190b3e (diff)
downloadtalos-op-linux-aff8da09f2381f0869faaf6637b0d892a3ee99ed.tar.gz
talos-op-linux-aff8da09f2381f0869faaf6637b0d892a3ee99ed.zip
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>
Diffstat (limited to 'drivers/md/raid1.c')
-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)
unsigned long flags;
const int op = bio_op(bio);
const unsigned long do_sync = (bio->bi_opf & REQ_SYNC);
- const unsigned long do_flush_fua = (bio->bi_opf &
- (REQ_PREFLUSH | REQ_FUA));
+ const unsigned long do_fua = (bio->bi_opf & REQ_FUA);
struct md_rdev *blocked_rdev;
struct blk_plug_cb *cb;
struct raid1_plug_cb *plug = NULL;
@@ -1509,7 +1508,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio)
conf->mirrors[i].rdev->data_offset);
mbio->bi_bdev = conf->mirrors[i].rdev->bdev;
mbio->bi_end_io = raid1_end_write_request;
- bio_set_op_attrs(mbio, op, do_flush_fua | do_sync);
+ bio_set_op_attrs(mbio, op, do_fua | do_sync);
if (test_bit(FailFast, &conf->mirrors[i].rdev->flags) &&
!test_bit(WriteMostly, &conf->mirrors[i].rdev->flags) &&
conf->raid_disks - mddev->degraded > 1)
@@ -1565,6 +1564,11 @@ static void raid1_make_request(struct mddev *mddev, struct bio *bio)
struct bio *split;
sector_t sectors;
+ if (unlikely(bio->bi_opf & REQ_PREFLUSH)) {
+ md_flush_request(mddev, bio);
+ return;
+ }
+
/* if bio exceeds barrier unit boundary, split it */
do {
sectors = align_to_barrier_unit_end(
OpenPOWER on IntegriCloud