Re: [PATCH] kernfs: avoid iattr allocation in listxattr

Tejun Heo <[email protected]> Sun, 2 Aug 2026 09:42:28 -1000
Newsgroups dev.linux.lists.driver-core,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Fri, Jul 31, 2026 at 08:05:54PM +0800, Yichong Chen wrote:
> 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 <[email protected]>

Acked-by: Tejun Heo <[email protected]>

Thanks.

-- 
tejun