linuxolator: LTP lseek03 failure

Bruce Evans bde at zeta.org.au
Wed May 9 12:48:59 UTC 2007


On Tue, 8 May 2007, Scot Hetzel wrote:

> On 5/6/07, Bruce Evans <bde at zeta.org.au> wrote:
>> On Sun, 6 May 2007, Scot Hetzel wrote:
>> 
>> > On 5/4/07, Scot Hetzel <swhetzel at gmail.com> wrote:
>> 
>> >> Would the best fix be to change the native lseek to return EINVAL when
>> >> fo_ioctl returns ENOTTY?
>> 
>> Probably.
>> ...
> I ran the lseek03 test on a unpatched kernel with a ZFS filesystem
> mounted on gentoo-stage3/tmp.  The lseek03 test did return with ENXIO
> with the ZFS tmp, and ENOTTY with a UFS tmp.
>
> I then created a patch to kern/vfs_vnops.c:vn_ioctl that checked if
> com was either SEEK_DATA or SEEK_HOLE and return EINVAL.  While this
> worked for UFS, it disabled SEEK_[DATA,HOLE] for ZFS.

I meant to just translate ENOTTY to EINVAL after calling VOP_IOCTL().
The vop must be called to see what it wants to do.

> So this wasn't the correct fix either.  The vn_ioctl function calls
> VOP_IOCTL. Should the fix be applied to VOP_IOCTL, or added to per
> filesystem *_ioctl functions.  Where is VOP_IOCTL defined in the src
> tree?

VOP_IOCTL is automatically generated from vnode_if.src into vnode_if.h.
The contents of vnode_if.h is uninteresting -- it is just glue code,
and you usually don't want to add to it (but there are some debugging
hooks that add to it).  When a whole ioctl is not supported, VOP_IOCTL
just calls vop_enotty() which just returns ENOTTY.  You probably don't
want to add to this either -- for of its most callers, ENOTTY is the
correct error code.

Bruce


More information about the freebsd-emulation mailing list