[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMowH6STCondvzuJ@mit.edu>
Date: Wed, 16 Jun 2021 13:08:47 -0400
From: "Theodore Ts'o" <tytso@....edu>
To: Trond Myklebust <trondmy@...merspace.com>
Cc: "hsiangkao@...ux.alibaba.com" <hsiangkao@...ux.alibaba.com>,
"linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
"joseph.qi@...ux.alibaba.com" <joseph.qi@...ux.alibaba.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"anna.schumaker@...app.com" <anna.schumaker@...app.com>
Subject: Re: [PATCH] nfs: set block size according to pnfs_blksize first
On Wed, Jun 16, 2021 at 03:14:17PM +0000, Trond Myklebust wrote:
> > should we transform it to E2BIG instead (at least in NFS
> > protocol)? but I'm still not sure that E2BIG is a valid return code for
> > setxattr()...
>
> The setxattr() manpage appears to suggest ERANGE is the correct return
> value here.
>
> ERANGE The size of name or value exceeds a filesystem-specific
> limit.
>
> However I can't tell if ext4 and xfs ever do that.
Ext4 will return ERANGE if the size of the xattr name is greater than
255 bytes. However, if there is no room to create the xattr --- for
example there is no space to allocate a file system block, ext4 will
return ENOSPC.
Without the ea_inode feature, ext2 and ext4 use a single 4k block to
store all extended attributes. So whether an xattr can be created is
dependent on whether there is room in that 4k block. If there are too
many xattrs, or the sum of the length of all the xattr names and
values plus a certain amount of overhead exceeds 4k, it will return
ENOSPC.
> Furthermore, it looks as if the VFS is always returning E2BIG if
> size > XATTR_SIZE_MAX.
This is defined by the attr_set(3) man page, but not in the
setxattr(2) man page. The set of errors are never intended to be
exhaustive --- there are some tcp-related errors that probably can
exposed to the caller when it is operating on a network-based file
system, for example. But it would probably be a good idea to update
the man pages so it's a bit clearer when E2BIG and ERANGE and ENOSPC
mean.
Cheers,
- Ted
Powered by blists - more mailing lists