From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx2.suse.de ([195.135.220.15]:54112 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729917AbfETIYQ (ORCPT ); Mon, 20 May 2019 04:24:16 -0400 From: Luis Henriques Subject: Re: [PATCH] src/attr_replace_test: limit size of extended attribute value References: <20190517120653.22180-1-lhenriques@suse.com> Date: Mon, 20 May 2019 09:24:14 +0100 In-Reply-To: (Nikolay Borisov's message of "Sun, 19 May 2019 20:27:31 +0300") Message-ID: <87o93xo7o1.fsf@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Sender: fstests-owner@vger.kernel.org Content-Transfer-Encoding: quoted-printable To: Nikolay Borisov Cc: fstests@vger.kernel.org, "Darrick J . Wong" List-ID: Nikolay Borisov writes: > On 17.05.19 =D0=B3. 15:06 =D1=87., Luis Henriques wrote: >> The maximum size for extended attribute values is 65536 (XATTR_SIZE_MA= X). >> 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. >>=20 >> Cc: Darrick J. Wong >> Signed-off-by: Luis Henriques >> --- >> src/attr_replace_test.c | 3 +++ >> 1 file changed, 3 insertions(+) >>=20 >> 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 >> #include >> #include >> +#include >> =20 >> #define die() do { perror(""); \ >> fprintf(stderr, "error at line %d\n", __LINE__); \ >> @@ -44,6 +45,8 @@ int main(int argc, char *argv[]) >> size =3D sbuf.st_blksize * 3 / 4; >> if (!size) >> fail("Invalid st_blksize(%ld)\n", sbuf.st_blksize); >> + if (size > XATTR_SIZE_MAX) >> + size =3D XATTR_SIZE_MAX; > > nit: size =3D 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() ;-) Cheers, --=20 Luis