From 52d4c7297794e87cb1855fcaa46704d78c07f9ec Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 27 May 2013 13:49:53 -0600 Subject: [PATCH] md: submit MMP reads REQ_SYNC to bypass RAID5 cache The ext4 MMP block reads always need to get fresh data from the underlying disk. Otherwise, if a remote node is updating the MMP block and the reads are fetched from the MD RAID5 stripe cache, it is possible that the local node will incorrectly decide the remote node has died and allow the filesystem to be mounted on two nodes at the same time. Intel-bug-id: LU-3506 Oracle-bug-id: b=17895 Signed-off-by: Andreas Dilger --- drivers/md/raid5.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 9359828..4143940 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2426,6 +2426,9 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in } if (sector >= sh->dev[dd_idx].sector + STRIPE_SECTORS) set_bit(R5_OVERWRITE, &sh->dev[dd_idx].flags); + } else if (bi->bi_rw & REQ_SYNC /* && !forwrite */) { + /* force to read from underlying disk if requested */ + clear_bit(R5_UPTODATE, &sh->dev[dd_idx].flags); } pr_debug("added bi b#%llu to stripe s#%llu, disk %d.\n", @@ -4396,6 +4399,9 @@ static void make_request(struct mddev *mddev, struct bio * bi) bi, 0); bio_endio(bi, 0); } + + if (bi->bi_rw & REQ_SYNC) + md_wakeup_thread(mddev->thread); } static sector_t raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks); -- 1.7.11.5