All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <lhenriques@suse.de>
To: Xiubo Li <xiubli@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>,
	fstests@vger.kernel.org, Dave Chinner <david@fromorbit.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Jeff Layton <jlayton@kernel.org>,
	ceph-devel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] generic/020: adjust max_attrval_size for ceph
Date: Fri, 10 Jun 2022 14:06:01 +0100	[thread overview]
Message-ID: <87k09ou0qu.fsf@orpheu.olymp> (raw)
In-Reply-To: <c2f88303-5360-6dca-93f1-a488f39f2325@redhat.com> (Xiubo Li's message of "Fri, 10 Jun 2022 08:47:09 +0800")

Xiubo Li <xiubli@redhat.com> writes:

> On 6/9/22 10:21 PM, David Disseldorp wrote:
>> Hi Luís,
>>
>> On Thu,  9 Jun 2022 11:53:42 +0100, Luís Henriques wrote:
>>
>>> CephFS doesn't have a maximum xattr size.  Instead, it imposes a maximum
>>> size for the full set of xattrs names+values, which by default is 64K.
>>>
>>> This patch fixes the max_attrval_size so that it is slightly < 64K in
>>> order to accommodate any already existing xattrs in the file.
>>>
>>> Signed-off-by: Luís Henriques <lhenriques@suse.de>
>>> ---
>>>   tests/generic/020 | 10 +++++++++-
>>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tests/generic/020 b/tests/generic/020
>>> index d8648e96286e..76f13220fe85 100755
>>> --- a/tests/generic/020
>>> +++ b/tests/generic/020
>>> @@ -128,7 +128,7 @@ _attr_get_max()
>>>   	pvfs2)
>>>   		max_attrval_size=8192
>>>   		;;
>>> -	xfs|udf|9p|ceph)
>>> +	xfs|udf|9p)
>>>   		max_attrval_size=65536
>>>   		;;
>>>   	bcachefs)
>>> @@ -139,6 +139,14 @@ _attr_get_max()
>>>   		# the underlying filesystem, so just use the lowest value above.
>>>   		max_attrval_size=1024
>>>   		;;
>>> +	ceph)
>>> +		# CephFS does not have a maximum value for attributes.  Instead,
>>> +		# it imposes a maximum size for the full set of xattrs
>>> +		# names+values, which by default is 64K.  Set this to a value
>>> +		# that is slightly smaller than 64K so that it can accommodate
>>> +		# already existing xattrs.
>>> +		max_attrval_size=65000
>>> +		;;
>> I take it a more exact calculation would be something like:
>> (64K - $max_attrval_namelen - sizeof(user.snrub="fish2\012"))?
>
> Yeah, something like this looks better to me.

Right, it could be hard-coded.  But we'd need to take into account that
the attribute value may not be ascii.  That's why my initial attempt to
fix this was to decode everything in hex.

> I am afraid without reaching up to the real max size we couldn't test the real
> bugs out from ceph. Such as the bug you fixed in ceph Locker.cc code.

OK, I'll change this to use the exact value.  Thanks, Xiubo.

Cheers,
-- 
Luis

>
>> Perhaps you could calculate this on the fly for CephFS by passing in the
>> filename and subtracting the `getfattr -d $filename` results... That
>> said, it'd probably get a bit ugly, expecially if encoding needs to be
>> taken into account.
>>
>> Reviewed-by: David Disseldorp <ddiss@suse.de>
>>
>> Cheers, David
>>
>

  reply	other threads:[~2022-06-10 13:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 10:53 [PATCH v2 0/2] Two xattrs-related fixes for ceph Luís Henriques
2022-06-09 10:53 ` [PATCH v2 1/2] generic/020: adjust max_attrval_size " Luís Henriques
2022-06-09 14:21   ` David Disseldorp
2022-06-09 14:54     ` Luís Henriques
2022-06-09 22:00       ` David Disseldorp
2022-06-10 13:01         ` Luis Henriques
2022-06-10  0:47     ` Xiubo Li
2022-06-10 13:06       ` Luis Henriques [this message]
2022-06-09 10:53 ` [PATCH v2 2/2] generic/486: adjust the max xattr size Luís Henriques
2022-06-10  5:35   ` Xiubo Li
2022-06-10  7:25     ` Dave Chinner
2022-06-10  9:19       ` Zorro Lang
2022-06-10 13:08         ` Luís Henriques

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=87k09ou0qu.fsf@orpheu.olymp \
    --to=lhenriques@suse.de \
    --cc=ceph-devel@vger.kernel.org \
    --cc=david@fromorbit.com \
    --cc=ddiss@suse.de \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=xiubli@redhat.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.