public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiubo Li <xiubli@redhat.com>
To: "Luís Henriques" <lhenriques@suse.de>,
	fstests@vger.kernel.org, "Darrick J. Wong" <djwong@kernel.org>
Cc: Jeff Layton <jlayton@kernel.org>, ceph-devel@vger.kernel.org
Subject: Re: [PATCH v2] src/attr_replace_test: dynamically adjust the max xattr size
Date: Wed, 8 Jun 2022 09:17:19 +0800	[thread overview]
Message-ID: <9c21300a-e731-443f-39a0-38da3204c975@redhat.com> (raw)
In-Reply-To: <20220607165153.27797-1-lhenriques@suse.de>


On 6/8/22 12:51 AM, Luís Henriques wrote:
> CephFS doesn't had a maximum xattr size.  Instead, it imposes a maximum size
> for the full set of xattrs names+values, which by default is 64K but may be
> changed.
>
> 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@suse.de>
> ---
>   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..d1b92703ba2a 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;

I am not sure whether will this break other filesystems tests.

Maybe we should get the filesystem type first from 'st_mode', and then 
in ceph case we should minus strlen(name) before replacing the it. And 
then if it fails with '-ENOSPC' do the following ?

Or maybe we could get maximum length of xattr from ioctl(fd) in ceph case ?


> +	} while ((ret < 0) && (errno == ENOSPC) && (size > 256));
>   	if (ret < 0) die();
>   	close(fd);
>   
>


  reply	other threads:[~2022-06-08  4:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 15:15 [PATCH 0/2] Two xattrs-related fixes for ceph Luís Henriques
2022-06-07 15:15 ` [PATCH 1/2] generic/020: adjust max_attrval_size " Luís Henriques
2022-06-08  0:16   ` Dave Chinner
2022-06-08  9:46     ` Luís Henriques
2022-06-08 21:53       ` Dave Chinner
2022-06-09  9:09         ` Luís Henriques
2022-06-08  8:41   ` Xiubo Li
2022-06-07 15:15 ` [PATCH 2/2] src/attr_replace_test: dynamically adjust the max xattr size Luís Henriques
2022-06-07 15:33   ` Darrick J. Wong
2022-06-07 16:20     ` Luís Henriques
2022-06-07 16:51       ` [PATCH v2] " Luís Henriques
2022-06-08  1:17         ` Xiubo Li [this message]
2022-06-08  0:23   ` [PATCH 2/2] " Dave Chinner
2022-06-08  9:57     ` Luís Henriques
2022-06-08 21:59       ` Dave Chinner
2022-06-09 10:32         ` Luís Henriques
2022-06-08  8:50   ` Xiubo Li

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=9c21300a-e731-443f-39a0-38da3204c975@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=lhenriques@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox