]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: don't drop dentry pages after fs shutdown
authorChao Yu <yuchao0@huawei.com>
Mon, 28 May 2018 08:59:26 +0000 (16:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:47:39 +0000 (07:47 +0200)
[ Upstream commit 1174abfd8309f4c47d454734233aa3b694560e10 ]

As description in commit "f2fs: don't drop any page on f2fs_cp_error()
case":

"We still provide readdir() after shtudown, so we should keep pages to
avoid additional IOs."

In order to provider lastest directory structure, let's keep dentry
pages in cache after fs shutdown.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
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>
fs/f2fs/data.c

index 02237d4d91f5a3e459114516cf7797f72ddc1daf..3dbd7ca2988e02d8bf40438f8d6d591d19c50835 100644 (file)
@@ -1745,6 +1745,12 @@ static int __write_data_page(struct page *page, bool *submitted,
        /* we should bypass data pages to proceed the kworkder jobs */
        if (unlikely(f2fs_cp_error(sbi))) {
                mapping_set_error(page->mapping, -EIO);
+               /*
+                * don't drop any dirty dentry pages for keeping lastest
+                * directory structure.
+                */
+               if (S_ISDIR(inode->i_mode))
+                       goto redirty_out;
                goto out;
        }