From a120c04cf969d7137e358c0619f7cf3f5dfbb2e4 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Thu, 4 May 2017 10:58:03 -0400 Subject: [PATCH] ext4: mark superblock writes synchronous for nobarrier mounts Commit bfd23d80bb09 "block: treat REQ_FUA and REQ_PREFLUSH as synchronous" removed REQ_SYNC flag from WRITE_FUA implementation. generic_make_request_checks() however strips REQ_FUA flag from a bio when the storage doesn't report volatile write cache and thus write effectively becomes asynchronous which can lead to performance regressions. This affects superblock writes for ext4. Fix the problem by marking superblock writes always as synchronous. Fixes: bfd23d80bb096a059c05d601125ab6a4fafd15d6 CC: linux-ext4@vger.kernel.org Signed-off-by: Jan Kara Signed-off-by: Theodore Ts'o --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9a40e0c16dcc7..931053cf20d6a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4637,7 +4637,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) if (sync) { unlock_buffer(sbh); error = __sync_dirty_buffer(sbh, - test_opt(sb, BARRIER) ? REQ_FUA : REQ_SYNC); + REQ_SYNC | (test_opt(sb, BARRIER) ? REQ_FUA : 0)); if (error) return error; -- 2.39.5