android_kernel_motorola_sm6225/fs/f2fs
Jaegeuk Kim 83def43454 f2fs: should use GFP_NOFS for directory inodes
commit 92d602bc7177325e7453189a22e0c8764ed3453e upstream.

We use inline_dentry which requires to allocate dentry page when adding a link.
If we allow to reclaim memory from filesystem, we do down_read(&sbi->cp_rwsem)
twice by f2fs_lock_op(). I think this should be okay, but how about stopping
the lockdep complaint [1]?

f2fs_create()
 - f2fs_lock_op()
 - f2fs_do_add_link()
  - __f2fs_find_entry
   - f2fs_get_read_data_page()
   -> kswapd
    - shrink_node
     - f2fs_evict_inode
      - f2fs_lock_op()

[1]

fs_reclaim
){+.+.}-{0:0}
:
kswapd0:        lock_acquire+0x114/0x394
kswapd0:        __fs_reclaim_acquire+0x40/0x50
kswapd0:        prepare_alloc_pages+0x94/0x1ec
kswapd0:        __alloc_pages_nodemask+0x78/0x1b0
kswapd0:        pagecache_get_page+0x2e0/0x57c
kswapd0:        f2fs_get_read_data_page+0xc0/0x394
kswapd0:        f2fs_find_data_page+0xa4/0x23c
kswapd0:        find_in_level+0x1a8/0x36c
kswapd0:        __f2fs_find_entry+0x70/0x100
kswapd0:        f2fs_do_add_link+0x84/0x1ec
kswapd0:        f2fs_mkdir+0xe4/0x1e4
kswapd0:        vfs_mkdir+0x110/0x1c0
kswapd0:        do_mkdirat+0xa4/0x160
kswapd0:        __arm64_sys_mkdirat+0x24/0x34
kswapd0:        el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8
kswapd0:        do_el0_svc+0x28/0xa0
kswapd0:        el0_svc+0x24/0x38
kswapd0:        el0_sync_handler+0x88/0xec
kswapd0:        el0_sync+0x1c0/0x200
kswapd0:
-> #1
(
&sbi->cp_rwsem
){++++}-{3:3}
:
kswapd0:        lock_acquire+0x114/0x394
kswapd0:        down_read+0x7c/0x98
kswapd0:        f2fs_do_truncate_blocks+0x78/0x3dc
kswapd0:        f2fs_truncate+0xc8/0x128
kswapd0:        f2fs_evict_inode+0x2b8/0x8b8
kswapd0:        evict+0xd4/0x2f8
kswapd0:        iput+0x1c0/0x258
kswapd0:        do_unlinkat+0x170/0x2a0
kswapd0:        __arm64_sys_unlinkat+0x4c/0x68
kswapd0:        el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8
kswapd0:        do_el0_svc+0x28/0xa0
kswapd0:        el0_svc+0x24/0x38
kswapd0:        el0_sync_handler+0x88/0xec
kswapd0:        el0_sync+0x1c0/0x200

Cc: stable@vger.kernel.org
Fixes: bdbc90fa55 ("f2fs: don't put dentry page in pagecache into highmem")
Reviewed-by: Chao Yu <chao@kernel.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Light Hsieh <light.hsieh@mediatek.com>
Tested-by: Light Hsieh <light.hsieh@mediatek.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-26 11:36:17 +01:00
..
acl.c f2fs: fix wrong return value of f2fs_acl_create 2019-02-12 19:47:02 +01:00
acl.h
checkpoint.c f2fs: fix to check segment boundary during SIT page readahead 2020-11-05 11:08:39 +01:00
data.c f2fs: Return EOF on unaligned end of file DIO read 2020-09-23 12:10:59 +02:00
debug.c f2fs: don't access node/meta inode mapping after iput 2019-07-10 09:53:45 +02:00
dir.c f2fs: fix uninit-value in f2fs_lookup 2020-11-05 11:08:39 +01:00
extent_cache.c f2fs: avoid sleeping under spin_lock 2018-11-13 11:08:37 -08:00
f2fs.h f2fs: prevent creating duplicate encrypted filenames 2021-01-06 14:44:58 +01:00
file.c f2fs: fix to unmap pages from userspace process in punch_hole() 2021-09-22 11:48:02 +02:00
gc.c f2fs: fix to account missing .skipped_gc_rwsem 2021-09-22 11:48:02 +02:00
gc.h f2fs: introduce sbi->gc_mode to determine the policy 2018-05-31 11:31:51 -07:00
hash.c f2fs: check entire encrypted bigname when finding a dentry 2017-05-04 11:44:35 -04:00
inline.c f2fs: fix a redundant call to f2fs_balance_fs if an error occurs 2021-05-22 10:59:42 +02:00
inode.c f2fs: should use GFP_NOFS for directory inodes 2021-11-26 11:36:17 +01:00
Kconfig fs/*/Kconfig: drop links to 404-compliant http://acl.bestbits.at 2018-01-01 12:45:37 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c f2fs: should use GFP_NOFS for directory inodes 2021-11-26 11:36:17 +01:00
node.c f2fs: fix to avoid out-of-bounds memory access 2021-05-22 10:59:19 +02:00
node.h f2fs: let checkpoint flush dnode page of regular 2018-08-01 11:52:36 -07:00
recovery.c f2fs: fix error path in do_recover_data() 2020-09-03 11:24:20 +02:00
segment.c f2fs: fix to account preflush command for noflush_merge mode 2019-12-13 08:51:48 +01:00
segment.h f2fs: handle unallocated section and zone on pinned/atgc 2021-03-07 12:18:59 +01:00
shrinker.c f2fs: fix sbi->extent_list corruption issue 2019-02-12 19:47:17 +01:00
super.c f2fs: add MODULE_SOFTDEP to ensure crc32 is included in the initramfs 2021-07-20 16:16:12 +02:00
sysfs.c f2fs: wait for sysfs kobject removal before freeing f2fs_sb_info 2020-10-30 10:38:20 +01:00
trace.c f2fs: do not use mutex lock in atomic context 2019-04-05 22:32:59 +02:00
trace.h
xattr.c f2fs: fix to avoid memory leakage in f2fs_listxattr 2020-04-29 16:31:17 +02:00
xattr.h f2fs: fix to avoid accessing xattr across the boundary 2019-06-19 08:18:02 +02:00