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

Alyssa Ross hi at alyssa.is
Mon May 3 22:42:07 UTC 2021


On Mon, May 03, 2021 at 05:06:52PM +0300, Dmitry V. Levin wrote:
> 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 ".".

Good point.

I looked into it further, and it's a bug in ZFS.  I sent this fix:
https://github.com/openzfs/zfs/pull/11995

I feel like if that fix is accepted, it's probably not worth fixing in
strace (even though the buggy behaviour is probably technically valid).
What do you think?  If you still think it's worth fixing, I'm happy to
send a v2 with your suggestion applied.

> > ---
> >  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20210503/2d777bbf/attachment.bin>


More information about the Strace-devel mailing list