]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
f2fs: fix to active page in lru list for read path
authorChao Yu <yuchao0@huawei.com>
Fri, 27 Jul 2018 10:15:14 +0000 (18:15 +0800)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:47:36 +0000 (19:47 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836117
[ Upstream commit 82cf4f132e6d16dca6fc3bd955019246141bc645 ]

If config CONFIG_F2FS_FAULT_INJECTION is on, for both read or write path
we will call find_lock_page() to get the page, but for read path, it
missed to passing FGP_ACCESSED to allocator to active the page in LRU
list, result in being reclaimed in advance incorrectly, fix it.

Reported-by: Xianrong Zhou <zhouxianrong@huawei.com>
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/f2fs/f2fs.h

index 25a4e5b9583366ab2cc93a5a2e7dc7085f801827..30c177de05d24ab1c09dc088a8cad0071efebdef 100644 (file)
@@ -1843,8 +1843,13 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,
                                                pgoff_t index, bool for_write)
 {
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-       struct page *page = find_lock_page(mapping, index);
+       struct page *page;
 
+       if (!for_write)
+               page = find_get_page_flags(mapping, index,
+                                               FGP_LOCK | FGP_ACCESSED);
+       else
+               page = find_lock_page(mapping, index);
        if (page)
                return page;