summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-07-06 16:47:34 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-26 08:39:39 +0200
commit22df0497e1046903ff0199f2041e7e4bc7935805 (patch)
tree4d6b709b4e3abecd63ead65eaa48a0265ded5ce2 /fs
parent6e530bf7d202a72b63dca3d67c0a14d0f6908f51 (diff)
downloadlinux-stable-22df0497e1046903ff0199f2041e7e4bc7935805.tar.gz
linux-stable-22df0497e1046903ff0199f2041e7e4bc7935805.tar.bz2
linux-stable-22df0497e1046903ff0199f2041e7e4bc7935805.zip
f2fs: do checkpoint in kill_sb
[ Upstream commit 1cb50f87e10696e8cc61fb62d0d948e11b0e6dc1 ] When unmounting f2fs in force mode, we can get it stuck by io_schedule() by some pending IOs in meta_inode. io_schedule+0xd/0x30 wait_on_page_bit_common+0xc6/0x130 __filemap_fdatawait_range+0xbd/0x100 filemap_fdatawait_keep_errors+0x15/0x40 sync_inodes_sb+0x1cf/0x240 sync_filesystem+0x52/0x90 generic_shutdown_super+0x1d/0x110 kill_f2fs_super+0x28/0x80 [f2fs] deactivate_locked_super+0x35/0x60 cleanup_mnt+0x36/0x70 task_work_run+0x79/0xa0 exit_to_usermode_loop+0x62/0x70 do_syscall_64+0xdb/0xf0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 0xffffffffffffffff Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/super.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 128d489acebb..742147cbe759 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3106,9 +3106,19 @@ static struct dentry *f2fs_mount(struct file_system_type *fs_type, int flags,
static void kill_f2fs_super(struct super_block *sb)
{
if (sb->s_root) {
- set_sbi_flag(F2FS_SB(sb), SBI_IS_CLOSE);
- f2fs_stop_gc_thread(F2FS_SB(sb));
- f2fs_stop_discard_thread(F2FS_SB(sb));
+ struct f2fs_sb_info *sbi = F2FS_SB(sb);
+
+ set_sbi_flag(sbi, SBI_IS_CLOSE);
+ f2fs_stop_gc_thread(sbi);
+ f2fs_stop_discard_thread(sbi);
+
+ if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) ||
+ !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) {
+ struct cp_control cpc = {
+ .reason = CP_UMOUNT,
+ };
+ f2fs_write_checkpoint(sbi, &cpc);
+ }
}
kill_block_super(sb);
}