linux-stable/fs/erofs
Gao Xiang 531a6b22b5 erofs: fix erofs_insert_workgroup() lockref usage
[ Upstream commit 1a0ac8bd7a ]

As Linus pointed out [1], lockref_put_return() is fundamentally
designed to be something that can fail.  It behaves as a fastpath-only
thing, and the failure case needs to be handled anyway.

Actually, since the new pcluster was just allocated without being
populated, it won't be accessed by others until it is inserted into
XArray, so lockref helpers are actually unneeded here.

Let's just set the proper reference count on initializing.

[1] https://lore.kernel.org/r/CAHk-=whCga8BeQnJ3ZBh_Hfm9ctba_wpF444LpwRybVNMzO6Dw@mail.gmail.com

Fixes: 7674a42f35 ("erofs: use struct lockref to replace handcrafted approach")
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20231031060524.1103921-1-hsiangkao@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:57:11 +01:00
..
Kconfig erofs: use HIPRI by default if per-cpu kthreads are enabled 2023-05-23 16:57:08 +08:00
Makefile erofs: avoid pcpubuf.c inclusion if CONFIG_EROFS_FS_ZIP is off 2023-05-23 16:56:40 +08:00
compress.h erofs: fold in z_erofs_decompress() 2023-05-29 15:54:49 +08:00
data.c splice: Use filemap_splice_read() instead of generic_file_splice_read() 2023-05-24 08:42:17 -06:00
decompressor.c erofs: simplify z_erofs_transform_plain() 2023-07-12 00:50:15 +08:00
decompressor_lzma.c erofs: fix memory leak of LZMA global compressed deduplication 2023-10-10 22:02:58 +02:00
dir.c erofs: keep meta inode into erofs_buf 2023-04-17 01:15:50 +08:00
erofs_fs.h erofs: cleanup i_format-related stuffs 2023-04-17 01:15:55 +08:00
fscache.c erofs: avoid hardcoded blocksize for subpage block support 2023-04-17 01:15:44 +08:00
inode.c erofs: fix fsdax unavailability for chunk-based regular files 2023-07-12 00:50:56 +08:00
internal.h erofs: use struct lockref to replace handcrafted approach 2023-06-18 12:10:47 +08:00
namei.c erofs: sunset erofs_dbg() 2023-04-17 01:15:54 +08:00
pcpubuf.c erofs: mark z_erofs_lzma_init/erofs_pcpubuf_init w/ __init 2023-03-09 22:49:30 +08:00
super.c erofs: allow empty device tags in flatdev mode 2023-10-10 22:02:59 +02:00
sysfs.c erofs: make kobj_type structures constant 2023-02-15 08:11:26 +08:00
utils.c erofs: fix erofs_insert_workgroup() lockref usage 2023-11-20 11:57:11 +01:00
xattr.c erofs: use separate xattr parsers for listxattr/getxattr 2023-06-18 12:10:54 +08:00
xattr.h Changes since last update: 2023-04-24 14:25:39 -07:00
zdata.c erofs: fix erofs_insert_workgroup() lockref usage 2023-11-20 11:57:11 +01:00
zmap.c erofs: clean up zmap.c 2023-06-22 21:16:34 +08:00