linux/fs/kernfs
Yichong Chen d5e81a5650 kernfs: avoid iattr allocation in listxattr
kernfs_iop_listxattr() only needs to report existing xattrs, but it uses
kernfs_iattrs(), which allocates kernfs_iattrs when the node does not
have one yet.

This makes a query operation create persistent per-node metadata even
when the xattr list is empty.

Use kernfs_iattrs_noalloc() instead and return an empty list when no
iattrs exist.

Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20260731120554.630147-1-chenyichong@uniontech.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-08-15 23:09:10 +02:00
..
dir.c kernfs: simplify kernfs_name_hash() 2026-07-18 16:07:22 +02:00
file.c kernfs: fix xattr race condition with multiple superblocks 2026-06-06 15:21:40 +02:00
inode.c kernfs: avoid iattr allocation in listxattr 2026-08-15 23:09:10 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kernfs-internal.h simpe_xattr: use per-sb cache 2026-06-06 15:21:41 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mount.c kernfs: fix xattr race condition with multiple superblocks 2026-06-06 15:21:40 +02:00
symlink.c kernfs: Replace strcpy(s, "../") with memcpy(s, "../", 4) 2026-07-18 16:07:22 +02:00