Commit 399c109d authored by Chengguang Xu's avatar Chengguang Xu Committed by Miklos Szeredi

ovl: sync dirty data when remounting to ro mode

sync_filesystem() does not sync dirty data for readonly filesystem during
umount, so before changing to readonly filesystem we should sync dirty data
for data integrity.
Signed-off-by: default avatarChengguang Xu <cgxu519@mykernel.net>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent c21c839b
...@@ -365,11 +365,20 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry) ...@@ -365,11 +365,20 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry)
static int ovl_remount(struct super_block *sb, int *flags, char *data) static int ovl_remount(struct super_block *sb, int *flags, char *data)
{ {
struct ovl_fs *ofs = sb->s_fs_info; struct ovl_fs *ofs = sb->s_fs_info;
struct super_block *upper_sb;
int ret = 0;
if (!(*flags & SB_RDONLY) && ovl_force_readonly(ofs)) if (!(*flags & SB_RDONLY) && ovl_force_readonly(ofs))
return -EROFS; return -EROFS;
return 0; if (*flags & SB_RDONLY && !sb_rdonly(sb)) {
upper_sb = ofs->upper_mnt->mnt_sb;
down_read(&upper_sb->s_umount);
ret = sync_filesystem(upper_sb);
up_read(&upper_sb->s_umount);
}
return ret;
} }
static const struct super_operations ovl_super_operations = { static const struct super_operations ovl_super_operations = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment