1 From foo@baz Sat Jul 28 10:25:26 CEST 2018
2 From: Sahitya Tummala <stummala@codeaurora.org>
3 Date: Fri, 18 May 2018 11:51:52 +0530
4 Subject: f2fs: Fix deadlock in shutdown ioctl
6 From: Sahitya Tummala <stummala@codeaurora.org>
8 [ Upstream commit 60b2b4ee2bc01dd052f99fa9d65da2232102ef8e ]
10 f2fs_ioc_shutdown() ioctl gets stuck in the below path
11 when issued with F2FS_GOING_DOWN_FULLSYNC option.
14 percpu_down_write+0x8c/0xc0
15 freeze_super+0xec/0x1e4
17 f2fs_ioctl+0xc0c/0x1ce0
18 f2fs_compat_ioctl+0x98/0x1f0
20 Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
21 Reviewed-by: Chao Yu <yuchao0@huawei.com>
22 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
23 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 fs/f2fs/file.c | 11 +++++++----
27 1 file changed, 7 insertions(+), 4 deletions(-)
31 @@ -1808,9 +1808,11 @@ static int f2fs_ioc_shutdown(struct file
32 if (get_user(in, (__u32 __user *)arg))
35 - ret = mnt_want_write_file(filp);
38 + if (in != F2FS_GOING_DOWN_FULLSYNC) {
39 + ret = mnt_want_write_file(filp);
45 case F2FS_GOING_DOWN_FULLSYNC:
46 @@ -1838,7 +1840,8 @@ static int f2fs_ioc_shutdown(struct file
48 f2fs_update_time(sbi, REQ_TIME);
50 - mnt_drop_write_file(filp);
51 + if (in != F2FS_GOING_DOWN_FULLSYNC)
52 + mnt_drop_write_file(filp);