Commit 5a8948f8 authored by Jan Kara's avatar Jan Kara Committed by Shaohua Li

md: Make flush bios explicitely sync

Commit b685d3d6 "block: treat REQ_FUA and REQ_PREFLUSH as
synchronous" removed REQ_SYNC flag from WRITE_{FUA|PREFLUSH|...}
definitions.  generic_make_request_checks() however strips REQ_FUA and
REQ_PREFLUSH flags from a bio when the storage doesn't report volatile
write cache and thus write effectively becomes asynchronous which can
lead to performance regressions

Fix the problem by making sure all bios which are synchronous are
properly marked with REQ_SYNC.

CC: linux-raid@vger.kernel.org
CC: Shaohua Li <shli@kernel.org>
Fixes: b685d3d6
CC: stable@vger.kernel.org
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent e1539036
...@@ -765,7 +765,7 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev, ...@@ -765,7 +765,7 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
test_bit(FailFast, &rdev->flags) && test_bit(FailFast, &rdev->flags) &&
!test_bit(LastDev, &rdev->flags)) !test_bit(LastDev, &rdev->flags))
ff = MD_FAILFAST; ff = MD_FAILFAST;
bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH | REQ_FUA | ff; bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH | REQ_FUA | ff;
atomic_inc(&mddev->pending_writes); atomic_inc(&mddev->pending_writes);
submit_bio(bio); submit_bio(bio);
......
...@@ -1782,7 +1782,7 @@ static int r5l_log_write_empty_meta_block(struct r5l_log *log, sector_t pos, ...@@ -1782,7 +1782,7 @@ static int r5l_log_write_empty_meta_block(struct r5l_log *log, sector_t pos,
mb->checksum = cpu_to_le32(crc32c_le(log->uuid_checksum, mb->checksum = cpu_to_le32(crc32c_le(log->uuid_checksum,
mb, PAGE_SIZE)); mb, PAGE_SIZE));
if (!sync_page_io(log->rdev, pos, PAGE_SIZE, page, REQ_OP_WRITE, if (!sync_page_io(log->rdev, pos, PAGE_SIZE, page, REQ_OP_WRITE,
REQ_FUA, false)) { REQ_SYNC | REQ_FUA, false)) {
__free_page(page); __free_page(page);
return -EIO; return -EIO;
} }
...@@ -2388,7 +2388,7 @@ r5c_recovery_rewrite_data_only_stripes(struct r5l_log *log, ...@@ -2388,7 +2388,7 @@ r5c_recovery_rewrite_data_only_stripes(struct r5l_log *log,
mb->checksum = cpu_to_le32(crc32c_le(log->uuid_checksum, mb->checksum = cpu_to_le32(crc32c_le(log->uuid_checksum,
mb, PAGE_SIZE)); mb, PAGE_SIZE));
sync_page_io(log->rdev, ctx->pos, PAGE_SIZE, page, sync_page_io(log->rdev, ctx->pos, PAGE_SIZE, page,
REQ_OP_WRITE, REQ_FUA, false); REQ_OP_WRITE, REQ_SYNC | REQ_FUA, false);
sh->log_start = ctx->pos; sh->log_start = ctx->pos;
list_add_tail(&sh->r5c, &log->stripe_in_journal_list); list_add_tail(&sh->r5c, &log->stripe_in_journal_list);
atomic_inc(&log->stripe_in_journal_count); atomic_inc(&log->stripe_in_journal_count);
......
...@@ -907,8 +907,8 @@ static int ppl_write_empty_header(struct ppl_log *log) ...@@ -907,8 +907,8 @@ static int ppl_write_empty_header(struct ppl_log *log)
pplhdr->checksum = cpu_to_le32(~crc32c_le(~0, pplhdr, PAGE_SIZE)); pplhdr->checksum = cpu_to_le32(~crc32c_le(~0, pplhdr, PAGE_SIZE));
if (!sync_page_io(rdev, rdev->ppl.sector - rdev->data_offset, if (!sync_page_io(rdev, rdev->ppl.sector - rdev->data_offset,
PPL_HEADER_SIZE, page, REQ_OP_WRITE | REQ_FUA, 0, PPL_HEADER_SIZE, page, REQ_OP_WRITE | REQ_SYNC |
false)) { REQ_FUA, 0, false)) {
md_error(rdev->mddev, rdev); md_error(rdev->mddev, rdev);
ret = -EIO; ret = -EIO;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment