From: "Luís Henriques" <lhenriques@suse.de>
To: fstests@vger.kernel.org
Cc: "Dave Chinner" <david@fromorbit.com>,
"Darrick J. Wong" <djwong@kernel.org>,
"Jeff Layton" <jlayton@kernel.org>,
"Xiubo Li" <xiubli@redhat.com>,
ceph-devel@vger.kernel.org, "Luís Henriques" <lhenriques@suse.de>
Subject: [PATCH v2 2/2] generic/486: adjust the max xattr size
Date: Thu, 9 Jun 2022 11:53:43 +0100 [thread overview]
Message-ID: <20220609105343.13591-3-lhenriques@suse.de> (raw)
In-Reply-To: <20220609105343.13591-1-lhenriques@suse.de>
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.
And since ceph reports 4M as the blocksize (the default ceph object size),
generic/486 will fail in this filesystem because it will end up using
XATTR_SIZE_MAX to set the size of the 2nd (big) xattr value.
The fix is to adjust the max size in attr_replace_test so that it takes
into account the initial xattr name and value lengths.
Signed-off-by: Luís Henriques <lhenriques@suse.de>
---
src/attr_replace_test.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/attr_replace_test.c b/src/attr_replace_test.c
index cca8dcf8ff60..1c8d1049a1d8 100644
--- a/src/attr_replace_test.c
+++ b/src/attr_replace_test.c
@@ -29,6 +29,11 @@ int main(int argc, char *argv[])
char *value;
struct stat sbuf;
size_t size = sizeof(value);
+ /*
+ * Take into account the initial (small) xattr name and value sizes and
+ * subtract them from the XATTR_SIZE_MAX maximum.
+ */
+ size_t maxsize = XATTR_SIZE_MAX - strlen(name) - 1;
if (argc != 2)
fail("Usage: %s <file>\n", argv[0]);
@@ -46,7 +51,7 @@ int main(int argc, char *argv[])
size = sbuf.st_blksize * 3 / 4;
if (!size)
fail("Invalid st_blksize(%ld)\n", sbuf.st_blksize);
- size = MIN(size, XATTR_SIZE_MAX);
+ size = MIN(size, maxsize);
value = malloc(size);
if (!value)
fail("Failed to allocate memory\n");
next prev parent reply other threads:[~2022-06-09 10:53 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
2022-06-09 10:53 ` Luís Henriques [this message]
2022-06-10 5:35 ` [PATCH v2 2/2] generic/486: adjust the max xattr size 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=20220609105343.13591-3-lhenriques@suse.de \
--to=lhenriques@suse.de \
--cc=ceph-devel@vger.kernel.org \
--cc=david@fromorbit.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox