]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: complete checkpoints during remount
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 19 Aug 2022 05:40:09 +0000 (22:40 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 13 Sep 2022 06:07:20 +0000 (23:07 -0700)
commit76bd0f37e36fc9bfe7676ef55c760e39115fd661
tree656b81e8ba684b5ac79f7e9772538a723e88669e
parentc7aa7ada5eae5fb98f50350af604a656f3c0f6fa
f2fs: complete checkpoints during remount

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>
fs/f2fs/super.c