diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-01-17 22:28:52 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-01-22 14:56:54 -0800 |
commit | d027c48447c2c2fab2b2aa1833436cf24ea567e9 (patch) | |
tree | efce3f30869678a5c0f1f435692a53c1be94e509 | |
parent | bb9e3bb8dbf5975a493e4e2dfbb900018579890c (diff) |
f2fs: hanlde error case in f2fs_ioc_shutdown
This patch makes f2fs_ioc_shutdown handling error case correctly.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/file.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index f31f0590cdc7..e20b01acbd2c 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1839,14 +1839,20 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) switch (in) { case F2FS_GOING_DOWN_FULLSYNC: sb = freeze_bdev(sb->s_bdev); - if (sb && !IS_ERR(sb)) { + if (IS_ERR(sb)) { + ret = PTR_ERR(sb); + goto out; + } + if (sb) { f2fs_stop_checkpoint(sbi, false); thaw_bdev(sb->s_bdev, sb); } break; case F2FS_GOING_DOWN_METASYNC: /* do checkpoint only */ - f2fs_sync_fs(sb, 1); + ret = f2fs_sync_fs(sb, 1); + if (ret) + goto out; f2fs_stop_checkpoint(sbi, false); break; case F2FS_GOING_DOWN_NOSYNC: |