Skip to content

Commit ab49589

Browse files
Jaegeuk Kimgregkh
authored andcommitted
f2fs: complete checkpoints during remount
commit 4f99484 upstream. Otherwise, pending checkpoints can contribute a race condition to give a quota warning. - Thread - checkpoint thread add checkpoints to the list do_remount() down_write(&sb->s_umount); f2fs_remount() block_operations() down_read_trylock(&sb->s_umount) = 0 up_write(&sb->s_umount); f2fs_quota_sync() dquot_writeback_dquots() WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)); Or, do_remount() down_write(&sb->s_umount); f2fs_remount() create a ckpt thread f2fs_enable_checkpoint() adds checkpoints wait for f2fs_sync_fs() trigger another pending checkpoint block_operations() down_read_trylock(&sb->s_umount) = 0 up_write(&sb->s_umount); f2fs_quota_sync() dquot_writeback_dquots() WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)); Cc: stable@vger.kernel.org Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0a408c6 commit ab49589

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/f2fs/super.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,6 +2152,9 @@ static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
21522152
up_write(&sbi->gc_lock);
21532153

21542154
f2fs_sync_fs(sbi->sb, 1);
2155+
2156+
/* Let's ensure there's no pending checkpoint anymore */
2157+
f2fs_flush_ckpt_thread(sbi);
21552158
}
21562159

21572160
static int f2fs_remount(struct super_block *sb, int *flags, char *data)
@@ -2318,6 +2321,9 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
23182321
f2fs_stop_ckpt_thread(sbi);
23192322
need_restart_ckpt = true;
23202323
} else {
2324+
/* Flush if the prevous checkpoint, if exists. */
2325+
f2fs_flush_ckpt_thread(sbi);
2326+
23212327
err = f2fs_start_ckpt_thread(sbi);
23222328
if (err) {
23232329
f2fs_err(sbi,

0 commit comments

Comments
 (0)