linux-stable/fs/f2fs
Chao Yu 0e2b7385cb f2fs: allocate proper size memory for zstd decompress
As 5kft <5kft@5kft.org> reported:

 kworker/u9:3: page allocation failure: order:9, mode:0x40c40(GFP_NOFS|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
 CPU: 3 PID: 8168 Comm: kworker/u9:3 Tainted: G         C        5.8.3-sunxi #trunk
 Hardware name: Allwinner sun8i Family
 Workqueue: f2fs_post_read_wq f2fs_post_read_work
 [<c010d6d5>] (unwind_backtrace) from [<c0109a55>] (show_stack+0x11/0x14)
 [<c0109a55>] (show_stack) from [<c056d489>] (dump_stack+0x75/0x84)
 [<c056d489>] (dump_stack) from [<c0243b53>] (warn_alloc+0xa3/0x104)
 [<c0243b53>] (warn_alloc) from [<c024473b>] (__alloc_pages_nodemask+0xb87/0xc40)
 [<c024473b>] (__alloc_pages_nodemask) from [<c02267c5>] (kmalloc_order+0x19/0x38)
 [<c02267c5>] (kmalloc_order) from [<c02267fd>] (kmalloc_order_trace+0x19/0x90)
 [<c02267fd>] (kmalloc_order_trace) from [<c047c665>] (zstd_init_decompress_ctx+0x21/0x88)
 [<c047c665>] (zstd_init_decompress_ctx) from [<c047e9cf>] (f2fs_decompress_pages+0x97/0x228)
 [<c047e9cf>] (f2fs_decompress_pages) from [<c045d0ab>] (__read_end_io+0xfb/0x130)
 [<c045d0ab>] (__read_end_io) from [<c045d141>] (f2fs_post_read_work+0x61/0x84)
 [<c045d141>] (f2fs_post_read_work) from [<c0130b2f>] (process_one_work+0x15f/0x3b0)
 [<c0130b2f>] (process_one_work) from [<c0130e7b>] (worker_thread+0xfb/0x3e0)
 [<c0130e7b>] (worker_thread) from [<c0135c3b>] (kthread+0xeb/0x10c)
 [<c0135c3b>] (kthread) from [<c0100159>]

zstd may allocate large size memory for {,de}compression, it may cause
file copy failure on low-end device which has very few memory.

For decompression, let's just allocate proper size memory based on current
file's cluster size instead of max cluster size.

Reported-by: 5kft <5kft@5kft.org>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-09-11 11:11:25 -07:00
..
Kconfig f2fs: compress: support lzo-rle compress algorithm 2020-05-11 20:36:46 -07:00
Makefile f2fs: support data compression 2020-01-17 16:48:07 -08:00
acl.c f2fs: Replace spaces with tab 2019-05-08 21:23:11 -07:00
acl.h f2fs: Use the correct style for SPDX License Identifier 2020-05-08 06:55:55 -07:00
checkpoint.c f2fs: support age threshold based garbage collection 2020-09-11 11:11:15 -07:00
compress.c f2fs: allocate proper size memory for zstd decompress 2020-09-11 11:11:25 -07:00
data.c f2fs: add block address limit check to compressed file 2020-09-11 11:11:25 -07:00
debug.c f2fs: change compr_blocks of superblock info to 64bit 2020-09-11 11:11:25 -07:00
dir.c f2fs: Use generic casefolding support 2020-09-10 14:03:31 -07:00
extent_cache.c f2fs: support 64-bits key in f2fs rb-tree node entry 2020-09-10 14:03:30 -07:00
f2fs.h f2fs: allocate proper size memory for zstd decompress 2020-09-11 11:11:25 -07:00
file.c f2fs: check position in move range ioctl 2020-09-11 11:11:25 -07:00
gc.c f2fs: support age threshold based garbage collection 2020-09-11 11:11:15 -07:00
gc.h f2fs: support age threshold based garbage collection 2020-09-11 11:11:15 -07:00
hash.c f2fs-for-5.8-rc1 2020-06-09 11:28:59 -07:00
inline.c f2fs: fix error path in do_recover_data() 2020-07-08 10:11:19 -07:00
inode.c f2fs: fix to wait page writeback before update 2020-07-07 21:51:45 -07:00
namei.c f2fs: space related cleanup 2020-07-26 08:15:40 -07:00
node.c f2fs: fix indefinite loop scanning for free nid 2020-09-08 20:31:33 -07:00
node.h f2fs: shrink spinlock coverage 2020-05-11 20:36:46 -07:00
recovery.c f2fs: fix error path in do_recover_data() 2020-07-08 10:11:19 -07:00
segment.c f2fs: support age threshold based garbage collection 2020-09-11 11:11:15 -07:00
segment.h f2fs: support age threshold based garbage collection 2020-09-11 11:11:15 -07:00
shrinker.c f2fs: fix inconsistent comments 2020-03-10 09:18:33 -07:00
super.c f2fs: support age threshold based garbage collection 2020-09-11 11:11:15 -07:00
sysfs.c f2fs: support age threshold based garbage collection 2020-09-11 11:11:15 -07:00
trace.c f2fs: do not use mutex lock in atomic context 2019-03-05 19:58:06 -08:00
trace.h f2fs: Use the correct style for SPDX License Identifier 2020-05-08 06:55:55 -07:00
verity.c f2fs: use macro instead of f2fs verity version 2020-08-03 10:32:51 -07:00
xattr.c f2fs: space related cleanup 2020-07-26 08:15:40 -07:00
xattr.h f2fs: code cleanup by removing ifdef macro surrounding 2020-05-26 18:56:10 -07:00