aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2011-06-14 00:20:19 -0400
committerNeilBrown <neilb@suse.de>2011-06-14 00:20:19 -0400
commitb062962edb086011e94ec4d9eb3f6a6d814f2a8f (patch)
tree4b832dab3687db5b719266d758a916bbc118e1f0 /drivers/md/raid5.c
parent9b2dc8b665932a8e681a7ab3237f60475e75e161 (diff)
md/raid5: fix FUA request handling in ops_run_io()
Commit e9c7469bb4f5 ("md: implment REQ_FLUSH/FUA support") introduced R5_WantFUA flag and set rw to WRITE_FUA in that case. However remaining code still checks whether rw is exactly same as WRITE or not, so FUAed-write ends up with being treated as READ. Fix it. This bug has been present since 2.6.37 and the fix is suitable for any -stable kernel since then. It is not clear why this has not caused more problems. Cc: Tejun Heo <tj@kernel.org> Cc: stable@kernel.org Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index af8a9a89e4d..b7dcc677dda 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -514,7 +514,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
514 bi = &sh->dev[i].req; 514 bi = &sh->dev[i].req;
515 515
516 bi->bi_rw = rw; 516 bi->bi_rw = rw;
517 if (rw == WRITE) 517 if (rw & WRITE)
518 bi->bi_end_io = raid5_end_write_request; 518 bi->bi_end_io = raid5_end_write_request;
519 else 519 else
520 bi->bi_end_io = raid5_end_read_request; 520 bi->bi_end_io = raid5_end_read_request;
@@ -548,13 +548,13 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
548 bi->bi_io_vec[0].bv_offset = 0; 548 bi->bi_io_vec[0].bv_offset = 0;
549 bi->bi_size = STRIPE_SIZE; 549 bi->bi_size = STRIPE_SIZE;
550 bi->bi_next = NULL; 550 bi->bi_next = NULL;
551 if (rw == WRITE && 551 if ((rw & WRITE) &&
552 test_bit(R5_ReWrite, &sh->dev[i].flags)) 552 test_bit(R5_ReWrite, &sh->dev[i].flags))
553 atomic_add(STRIPE_SECTORS, 553 atomic_add(STRIPE_SECTORS,
554 &rdev->corrected_errors); 554 &rdev->corrected_errors);
555 generic_make_request(bi); 555 generic_make_request(bi);
556 } else { 556 } else {
557 if (rw == WRITE) 557 if (rw & WRITE)
558 set_bit(STRIPE_DEGRADED, &sh->state); 558 set_bit(STRIPE_DEGRADED, &sh->state);
559 pr_debug("skip op %ld on disc %d for sector %llu\n", 559 pr_debug("skip op %ld on disc %d for sector %llu\n",
560 bi->bi_rw, i, (unsigned long long)sh->sector); 560 bi->bi_rw, i, (unsigned long long)sh->sector);