linux/fs/erofs
Jiucheng Xu d6565ea662 erofs: add GFP_NOIO in the bio completion if needed
commit c23df30915 upstream.

The bio completion path in the process context (e.g. dm-verity)
will directly call into decompression rather than trigger another
workqueue context for minimal scheduling latencies, which can
then call vm_map_ram() with GFP_KERNEL.

Due to insufficient memory, vm_map_ram() may generate memory
swapping I/O, which can cause submit_bio_wait to deadlock
in some scenarios.

Trimmed down the call stack, as follows:

f2fs_submit_read_io
  submit_bio                      //bio_list is initialized.
    mmc_blk_mq_recovery
      z_erofs_endio
        vm_map_ram
          __pte_alloc_kernel
            __alloc_pages_direct_reclaim
              shrink_folio_list
                __swap_writepage
                  submit_bio_wait  //bio_list is non-NULL, hang!!!

Use memalloc_noio_{save,restore}() to wrap up this path.

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Jiucheng Xu <jiucheng.xu@amlogic.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-04-18 10:33:27 +02:00
..
compress.h erofs: clean up file headers & footers 2021-06-08 00:41:24 +08:00
data.c erofs: apply proper VMA alignment for memory mapped files on THP 2024-03-15 10:48:15 -04:00
decompressor.c erofs: fix lz4 inplace decompression 2024-03-01 13:21:48 +01:00
dir.c erofs: clean up file headers & footers 2021-06-08 00:41:24 +08:00
erofs_fs.h erofs: introduce chunk-based file on-disk format 2021-08-20 22:38:01 +08:00
inode.c erofs: fix incorrect symlink detection in fast symlink 2025-01-09 13:28:30 +01:00
internal.h erofs: decouple basic mount options from fs_context 2023-07-23 13:47:44 +02:00
Kconfig erofs: iomap support for non-tailpacking DIO 2021-08-10 00:14:42 +08:00
Makefile erofs: introduce multipage per-CPU buffers 2021-04-10 03:19:59 +08:00
namei.c erofs: add fiemap support with iomap 2021-08-19 00:13:43 +08:00
pcpubuf.c erofs: introduce multipage per-CPU buffers 2021-04-10 03:19:59 +08:00
super.c erofs: decouple basic mount options from fs_context 2023-07-23 13:47:44 +02:00
tagptr.h erofs: clean up file headers & footers 2021-06-08 00:41:24 +08:00
utils.c erofs: fix deadlock when shrink erofs slab 2021-12-01 09:04:50 +01:00
xattr.c erofs: decouple basic mount options from fs_context 2023-07-23 13:47:44 +02:00
xattr.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
zdata.c erofs: add GFP_NOIO in the bio completion if needed 2026-04-18 10:33:27 +02:00
zdata.h minmax: add a few more MIN_T/MAX_T users 2025-10-19 16:21:52 +02:00
zmap.c erofs: fix compact 4B support for 16k block size 2023-07-23 13:47:48 +02:00
zpvec.h erofs: fix unsafe pagevec reuse of hooked pclusters 2021-11-18 19:17:15 +01:00