diff options
| author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-03-24 10:29:39 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-13 12:33:17 +0200 |
| commit | 3d47c996cf012027e2fe3dacc154749fd91034f4 (patch) | |
| tree | 4bb0d7d9cd9cfbba02533a5aa1068dd6a6b7a92d | |
| parent | d29b0443f2b61f3ae61c95d1a0ec2a26858b2563 (diff) | |
f2fs: treat as a normal umount when remounting ro
When user remounts f2fs as read-only, we can mark the checkpoint as umount.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/super.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index e6e205001..cc27fd3f1 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -790,11 +790,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) org_mount_opt = sbi->mount_opt; active_logs = sbi->active_logs; - if (*flags & MS_RDONLY) { - set_opt(sbi, FASTBOOT); - set_sbi_flag(sbi, SBI_IS_DIRTY); - } - /* recover superblocks we couldn't write due to previous RO mount */ if (!(*flags & MS_RDONLY) && is_sbi_flag_set(sbi, SBI_NEED_SB_WRITE)) { err = f2fs_commit_super(sbi, false); @@ -804,8 +799,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) clear_sbi_flag(sbi, SBI_NEED_SB_WRITE); } - sync_filesystem(sb); - sbi->mount_opt.opt = 0; default_options(sbi); @@ -837,7 +830,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) if ((*flags & MS_RDONLY) || !test_opt(sbi, BG_GC)) { if (sbi->gc_thread) { stop_gc_thread(sbi); - f2fs_sync_fs(sb, 1); need_restart_gc = true; } } else if (!sbi->gc_thread) { @@ -847,6 +839,16 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) need_stop_gc = true; } + if (*flags & MS_RDONLY) { + writeback_inodes_sb(sb, WB_REASON_SYNC); + sync_inodes_sb(sb); + + set_sbi_flag(sbi, SBI_IS_DIRTY); + set_sbi_flag(sbi, SBI_IS_CLOSE); + f2fs_sync_fs(sb, 1); + clear_sbi_flag(sbi, SBI_IS_CLOSE); + } + /* * We stop issue flush thread if FS is mounted as RO * or if flush_merge is not passed in mount option. |
