All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <lhenriques@suse.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: fstests@vger.kernel.org, "Darrick J . Wong" <darrick.wong@oracle.com>
Subject: Re: [PATCH] src/attr_replace_test: limit size of extended attribute value
Date: Mon, 20 May 2019 09:24:14 +0100	[thread overview]
Message-ID: <87o93xo7o1.fsf@suse.com> (raw)
In-Reply-To: <a7ca5248-89ce-6695-7809-9c2c483a5142@suse.com> (Nikolay Borisov's message of "Sun, 19 May 2019 20:27:31 +0300")

Nikolay Borisov <nborisov@suse.com> 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@oracle.com>
>> Signed-off-by: Luis Henriques <lhenriques@suse.com>
>> ---
>>  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() ;-)

Cheers,
-- 
Luis

  reply	other threads:[~2019-05-20  8:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 12:06 [PATCH] src/attr_replace_test: limit size of extended attribute value Luis Henriques
2019-05-19 17:27 ` Nikolay Borisov
2019-05-20  8:24   ` Luis Henriques [this message]
2019-05-20  8:27     ` Nikolay Borisov
2019-05-21  8:28       ` [PATCH v2] " Luis Henriques
2019-05-21 18:17         ` Darrick J. Wong
2019-05-20 16:23 ` [PATCH] " Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o93xo7o1.fsf@suse.com \
    --to=lhenriques@suse.com \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.