On Tue, Jun 07, 2022 at 04:15:13PM +0100, Luís Henriques wrote: > CephFS doesn't had a maximum xattr size. Instead, it imposes a maximum > size for the full set of an inode's xattrs names+values, which by default > is 64K but it can be changed by a cluster admin. > > Test generic/486 started to fail after fixing a ceph bug where this limit > wasn't being imposed. Adjust dynamically the size of the xattr being set > if the error returned is -ENOSPC. > > Signed-off-by: Luís Henriques <lhenriques@xxxxxxx> > --- > src/attr_replace_test.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/attr_replace_test.c b/src/attr_replace_test.c > index cca8dcf8ff60..de18e643f469 100644 > --- a/src/attr_replace_test.c > +++ b/src/attr_replace_test.c > @@ -62,7 +62,10 @@ int main(int argc, char *argv[]) > > /* Then, replace it with bigger one, forcing short form to leaf conversion. */ > memset(value, '1', size); > - ret = fsetxattr(fd, name, value, size, XATTR_REPLACE); > + do { > + ret = fsetxattr(fd, name, value, size, XATTR_REPLACE); > + size -= 256; > + } while ((ret < 0) && (errno == ENOSPC) && (size > 0)); Isn't @size a size_t? Which means that it can't be less than zero? I wouldn't count on st_blksize (or XATTR_SIZE_MAX) always being a multiple of 256. --D > if (ret < 0) die(); > close(fd); >