Skip to content

Commit

Permalink
exfat: call sync_filesystem for read-only remount
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hyunchul Lee authored and Namjae Jeon committed Jun 29, 2020
1 parent e8dd3cd commit a0271a1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/exfat/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,20 @@ static void exfat_free(struct fs_context *fc)
}
}

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)
Expand Down

0 comments on commit a0271a1

Please sign in to comment.