[PATCH v2] tests/file_handle.c: skip if fs can't do handles

Alyssa Ross hi at alyssa.is
Tue May 4 00:29:18 UTC 2021


Quoting name_to_handle_at(2):

> Some care is needed here as EOVERFLOW can also indicate that no file
> handle is available for this particular name in a filesystem which
> does normally support file-handle lookup.  This case can be detected
> when the EOVERFLOW error is returned without handle_bytes being
> increased.

This patch handles that case, resolving 20 failures for me on ZFS, and
making `make check' able to run successfully.
---
 tests/file_handle.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/file_handle.c b/tests/file_handle.c
index 86d51b63..a07fce46 100644
--- a/tests/file_handle.c
+++ b/tests/file_handle.c
@@ -206,8 +206,13 @@ main(void)
 	       path, path_secontext,
 	       handle->handle_bytes, &mount_id);
 
-	assert(syscall(__NR_name_to_handle_at, fdcwd, path, handle, &mount_id,
-		flags) == 0);
+	if (syscall(__NR_name_to_handle_at, fdcwd, path, handle, &mount_id,
+		    flags)) {
+		if (EOVERFLOW == errno)
+			perror_msg_and_skip("name_to_handle_at");
+		else
+			perror_msg_and_fail("name_to_handle_at");
+	}
 	printf("%s%s(AT_FDCWD, \"%s\"%s, {handle_bytes=%u"
 	       ", handle_type=%d, f_handle=",
 	       my_secontext, "name_to_handle_at",
-- 
2.31.0



More information about the Strace-devel mailing list