mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
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 <hyc.lee@gmail.com> Acked-by: Sungjong Seo <sj1557.seo@samsung.com> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
This commit is contained in:
parent
117088f39d
commit
c5a2c1ed8b
1 changed files with 23 additions and 0 deletions
23
super.c
23
super.c
|
|
@ -207,6 +207,18 @@ static void exfat_destroy_inode(struct inode *inode)
|
|||
{
|
||||
call_rcu(&inode->i_rcu, exfat_i_callback);
|
||||
}
|
||||
|
||||
static int exfat_remount(struct super_block *sb, int *flags, char *data)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
|
||||
*flags |= SB_NODIRATIME;
|
||||
#else
|
||||
*flags |= MS_NODIRATIME;
|
||||
#endif
|
||||
|
||||
sync_filesystem(sb);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct super_operations exfat_sops = {
|
||||
|
|
@ -215,6 +227,7 @@ static const struct super_operations exfat_sops = {
|
|||
.free_inode = exfat_free_inode,
|
||||
#else
|
||||
.destroy_inode = exfat_destroy_inode,
|
||||
.remount_fs = exfat_remount,
|
||||
#endif
|
||||
.write_inode = exfat_write_inode,
|
||||
.evict_inode = exfat_evict_inode,
|
||||
|
|
@ -963,10 +976,20 @@ static void exfat_free(struct fs_context *fc)
|
|||
kfree(fc->s_fs_info);
|
||||
}
|
||||
|
||||
static int exfat_reconfigure(struct fs_context *fc)
|
||||
{
|
||||
fc->sb_flags |= SB_NODIRATIME;
|
||||
|
||||
/* volume flag will be updated in exfat_sync_fs */
|
||||
sync_filesystem(fc->root->d_sb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct fs_context_operations exfat_context_ops = {
|
||||
.parse_param = exfat_parse_param,
|
||||
.get_tree = exfat_get_tree,
|
||||
.free = exfat_free,
|
||||
.reconfigure = exfat_reconfigure,
|
||||
};
|
||||
|
||||
static int exfat_init_fs_context(struct fs_context *fc)
|
||||
|
|
|
|||
Loading…
Reference in a new issue