Skip to content

Commit a0271a1

Browse files
hcleenamjaejeon
authored andcommitted
exfat: call sync_filesystem for read-only remount
We need to commit dirty metadata and pages to disk before remounting exfat as read-only. This fixes a failure in xfstests generic/452 generic/452 does the following: cp something <exfat>/ mount -o remount,ro <exfat> the <exfat>/something is corrupted. because while exfat is remounted as read-only, exfat doesn't have a chance to commit metadata and vfs invalidates page caches in a block device. Signed-off-by: Hyunchul Lee <[email protected]> Acked-by: Sungjong Seo <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent e8dd3cd commit a0271a1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/exfat/super.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,20 @@ static void exfat_free(struct fs_context *fc)
693693
}
694694
}
695695

696+
static int exfat_reconfigure(struct fs_context *fc)
697+
{
698+
fc->sb_flags |= SB_NODIRATIME;
699+
700+
/* volume flag will be updated in exfat_sync_fs */
701+
sync_filesystem(fc->root->d_sb);
702+
return 0;
703+
}
704+
696705
static const struct fs_context_operations exfat_context_ops = {
697706
.parse_param = exfat_parse_param,
698707
.get_tree = exfat_get_tree,
699708
.free = exfat_free,
709+
.reconfigure = exfat_reconfigure,
700710
};
701711

702712
static int exfat_init_fs_context(struct fs_context *fc)

0 commit comments

Comments
 (0)