summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2020-06-08 20:03:16 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2020-06-08 20:37:53 -0700
commit8626441f05dc45a2f4693ee6863d02456ce39e60 (patch)
treef4f61ada7bad34477c523a2ca1f658c2e1ae6037 /fs/f2fs/file.c
parentfc3bb095ab02b9e7d89a069ade2cead15c64c504 (diff)
f2fs: handle readonly filesystem in f2fs_ioc_shutdown()
If mountpoint is readonly, we should allow shutdowning filesystem successfully, this fixes issue found by generic/599 testcase of xfstest. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index dfa1ac2d751a..3268f8dd59bb 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2232,8 +2232,15 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
if (in != F2FS_GOING_DOWN_FULLSYNC) {
ret = mnt_want_write_file(filp);
- if (ret)
+ if (ret) {
+ if (ret == -EROFS) {
+ ret = 0;
+ f2fs_stop_checkpoint(sbi, false);
+ set_sbi_flag(sbi, SBI_IS_SHUTDOWN);
+ trace_f2fs_shutdown(sbi, in, ret);
+ }
return ret;
+ }
}
switch (in) {