]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: handle readonly filesystem in f2fs_ioc_shutdown()
authorChao Yu <yuchao0@huawei.com>
Mon, 8 Jun 2020 12:03:16 +0000 (20:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:31 +0000 (17:48 +0200)
[ Upstream commit 8626441f05dc45a2f4693ee6863d02456ce39e60 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/file.c

index 6ab8f621a3c5a25caa268c55f021488180efb3f2..30b35915fa3a3b975f4ad801525ce5383174a3a5 100644 (file)
@@ -2219,8 +2219,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) {