[PATCH] tests/file_handle.c: skip if fs can't do handles
Dmitry V. Levin
ldv at altlinux.org
Mon May 3 14:06:52 UTC 2021
On Mon, May 03, 2021 at 01:12:13PM +0000, Alyssa Ross wrote:
> 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.
I must admit I'm a bit surprised that a filesystem supporting file-handle
lookups can fail to return a file handle for ".".
> ---
> tests/file_handle.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/file_handle.c b/tests/file_handle.c
> index 86d51b63..da544c2f 100644
> --- a/tests/file_handle.c
> +++ b/tests/file_handle.c
> @@ -206,8 +206,11 @@ main(void)
> path, path_secontext,
> handle->handle_bytes, &mount_id);
>
> - assert(syscall(__NR_name_to_handle_at, fdcwd, path, handle, &mount_id,
> - flags) == 0);
> + errno = 0;
> + syscall(__NR_name_to_handle_at, fdcwd, path, handle, &mount_id, flags);
> + if (EOVERFLOW == errno)
> + perror_msg_and_skip("name_to_handle_at");
> + assert(!errno);
Please check the syscall return value here, e.g.:
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");
}
--
ldv
More information about the Strace-devel
mailing list