Re: [PATCH 09/14] xattr: move user limits for xattrs to generic infra
From: Christian Brauner
Date: Mon Feb 23 2026 - 07:13:36 EST
On Fri, Feb 20, 2026 at 04:03:26PM -0800, Darrick J. Wong wrote:
> On Mon, Feb 16, 2026 at 02:32:05PM +0100, Christian Brauner wrote:
> > Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
> > ---
> > fs/kernfs/inode.c | 75 ++-------------------------------------------
> > fs/kernfs/kernfs-internal.h | 3 +-
> > fs/xattr.c | 65 +++++++++++++++++++++++++++++++++++++++
> > include/linux/kernfs.h | 2 --
> > include/linux/xattr.h | 18 +++++++++++
> > 5 files changed, 87 insertions(+), 76 deletions(-)
> >
>
> I know you're just moving code around and that looks ok, but:
>
> > diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
> > index b5a5f32fdfd1..d8f57f0af5e4 100644
> > --- a/include/linux/kernfs.h
> > +++ b/include/linux/kernfs.h
> > @@ -99,8 +99,6 @@ enum kernfs_node_type {
> >
> > #define KERNFS_TYPE_MASK 0x000f
> > #define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK
> > -#define KERNFS_MAX_USER_XATTRS 128
> > -#define KERNFS_USER_XATTR_SIZE_LIMIT (128 << 10)
>
> I guess this means you can't have more than 128 xattrs total, and
> sum(values) must be less than 128k? The fixed limit is a little odd,
> but it's all pinned kernel memory, right?
Yeah, it's all pinned kernel memory.
> (IOWs, you haven't done anything wild ala xfile.c to make it possible to
> swap that out to disk?)
First time I've seen that. Very creative. But no, I've not done that.
cgroupfs has been fine with a fixed limit for a long time no so for now
it's fine to assume sockfs will be as well.