Blame SOURCES/0041-exfat-call-sync_filesystem-for-read-only-remount.patch

Kmods SIG 9e3ffb
From a0271a15cf2cf907ea5b0f2ba611123f1b7935ec Mon Sep 17 00:00:00 2001
Kmods SIG 9e3ffb
From: Hyunchul Lee <hyc.lee@gmail.com>
Kmods SIG 9e3ffb
Date: Tue, 16 Jun 2020 14:34:45 +0900
Kmods SIG 9e3ffb
Subject: [Backport a0271a15cf2c] exfat: call sync_filesystem for read-only
Kmods SIG 9e3ffb
 remount
Kmods SIG 9e3ffb
Kmods SIG 9e3ffb
We need to commit dirty metadata and pages to disk
Kmods SIG 9e3ffb
before remounting exfat as read-only.
Kmods SIG 9e3ffb
Kmods SIG 9e3ffb
This fixes a failure in xfstests generic/452
Kmods SIG 9e3ffb
Kmods SIG 9e3ffb
generic/452 does the following:
Kmods SIG 9e3ffb
cp something <exfat>/
Kmods SIG 9e3ffb
mount -o remount,ro <exfat>
Kmods SIG 9e3ffb
Kmods SIG 9e3ffb
the <exfat>/something is corrupted. because while
Kmods SIG 9e3ffb
exfat is remounted as read-only, exfat doesn't
Kmods SIG 9e3ffb
have a chance to commit metadata and
Kmods SIG 9e3ffb
vfs invalidates page caches in a block device.
Kmods SIG 9e3ffb
Kmods SIG 9e3ffb
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Kmods SIG 9e3ffb
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Kmods SIG 9e3ffb
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Kmods SIG 9e3ffb
---
Kmods SIG 9e3ffb
 src/super.c | 10 ++++++++++
Kmods SIG 9e3ffb
 1 file changed, 10 insertions(+)
Kmods SIG 9e3ffb
Kmods SIG 9e3ffb
diff --git a/src/super.c b/src/super.c
Kmods SIG 9e3ffb
index e650e65536f848c544b731f273b5f8839298e850..253a92460d5222f4f3aa75e52fc0b3eab084bc06 100644
Kmods SIG 9e3ffb
--- a/src/super.c
Kmods SIG 9e3ffb
+++ b/src/super.c
Kmods SIG 9e3ffb
@@ -693,10 +693,20 @@ static void exfat_free(struct fs_context *fc)
Kmods SIG 9e3ffb
 	}
Kmods SIG 9e3ffb
 }
Kmods SIG 9e3ffb
 
Kmods SIG 9e3ffb
+static int exfat_reconfigure(struct fs_context *fc)
Kmods SIG 9e3ffb
+{
Kmods SIG 9e3ffb
+	fc->sb_flags |= SB_NODIRATIME;
Kmods SIG 9e3ffb
+
Kmods SIG 9e3ffb
+	/* volume flag will be updated in exfat_sync_fs */
Kmods SIG 9e3ffb
+	sync_filesystem(fc->root->d_sb);
Kmods SIG 9e3ffb
+	return 0;
Kmods SIG 9e3ffb
+}
Kmods SIG 9e3ffb
+
Kmods SIG 9e3ffb
 static const struct fs_context_operations exfat_context_ops = {
Kmods SIG 9e3ffb
 	.parse_param	= exfat_parse_param,
Kmods SIG 9e3ffb
 	.get_tree	= exfat_get_tree,
Kmods SIG 9e3ffb
 	.free		= exfat_free,
Kmods SIG 9e3ffb
+	.reconfigure	= exfat_reconfigure,
Kmods SIG 9e3ffb
 };
Kmods SIG 9e3ffb
 
Kmods SIG 9e3ffb
 static int exfat_init_fs_context(struct fs_context *fc)
Kmods SIG 9e3ffb
-- 
Kmods SIG 9e3ffb
2.31.1
Kmods SIG 9e3ffb