diff mbox series

[v2] src/attr_replace_test: dynamically adjust the max xattr size

Message ID 20220607165153.27797-1-lhenriques@suse.de
State New
Headers show
Series [v2] src/attr_replace_test: dynamically adjust the max xattr size | expand

Commit Message

Luis Henriques June 7, 2022, 4:51 p.m. UTC
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 mbox series

Patch

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;
+	} while ((ret < 0) && (errno == ENOSPC) && (size > 256));
 	if (ret < 0) die();
 	close(fd);