On 20.05.19 г. 11:24 ч., Luis Henriques wrote: > Nikolay Borisov <nborisov@xxxxxxxx> writes: > >> On 17.05.19 г. 15:06 ч., Luis Henriques wrote: >>> The maximum size for extended attribute values is 65536 (XATTR_SIZE_MAX). >>> Since there are filesystems that can set blksize to really big values >>> (CephFS for example has a default of 4M), it's easy to have this test >>> failing with fsetxattr returning -E2BIG. >>> >>> Cc: Darrick J. Wong <darrick.wong@xxxxxxxxxx> >>> Signed-off-by: Luis Henriques <lhenriques@xxxxxxxx> >>> --- >>> src/attr_replace_test.c | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/src/attr_replace_test.c b/src/attr_replace_test.c >>> index 0720bfdc18ab..1ca9bf11ba58 100644 >>> --- a/src/attr_replace_test.c >>> +++ b/src/attr_replace_test.c >>> @@ -9,6 +9,7 @@ >>> #include <sys/types.h> >>> #include <sys/xattr.h> >>> #include <sys/stat.h> >>> +#include <linux/limits.h> >>> >>> #define die() do { perror(""); \ >>> fprintf(stderr, "error at line %d\n", __LINE__); \ >>> @@ -44,6 +45,8 @@ int main(int argc, char *argv[]) >>> size = sbuf.st_blksize * 3 / 4; >>> if (!size) >>> fail("Invalid st_blksize(%ld)\n", sbuf.st_blksize); >>> + if (size > XATTR_SIZE_MAX) >>> + size = XATTR_SIZE_MAX; >> >> nit: size = max(size, XATTRS_SIZE_MAX); > > Thanks, Nikolay. But I can't find the definition of such macro or > function. I believe it's only available in kernel, right? Also, you > probably meant min() ;-) Yeah, re min, but it seems there is a MIN/MAX macros provided in <sys/param.h>. Anyway, as mentioned initially this is a minor point :) . > > Cheers, >