Russ Weeks wrote:
> On Fri, Aug 21, 2009 at 3:24 AM, Frank Batschulat
> (Home)<Frank.Batschulat at sun.com> wrote:
>
>> I bet when you dtrace the kernel exportfs syscall s entry exportfs() you'll
>> find that it fails
>> in treeclimb_export() because your underlaying FUSE file system does
>> not implement VOP_FID(). this is during the time we attempt
>> build the servers namespace for the export.
>>
>> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/nfs/nfs_export.c#997
>> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c#555
>> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c#vop_fid_pseudo
>>
>> dtrace will tell you for sure.
>>
>
> Thanks, Frank. I tried to attach a probe to treeclimb_export:return
> but found that it never got fired when I tried to export the
> FUSE-based filesystem. Or maybe my DTrace mojo isn't strong enough.
> But I traced the exportfs call using the script below and found
> something that definitely points to a problem with fop_fid. The
> trimmed trace looks like this:
>
> CPU FUNCTION
> 0 -> exportfs
> 0 -> lookupname
> [a bunch of stuff here]
> 0 <- lookupname
> 0 -> fop_access
> 0 -> crgetmapped
> 0 <- crgetmapped
> 0 -> fuse_access
> [a bunch of FUSE-related stuff here]
> 0 <- fuse_access
> 0 <- fop_access
> 0 -> vn_mountedvfs
> 0 <- vn_mountedvfs
> 0 -> fop_fid
> 0 -> fs_nosys
> 0 <- fs_nosys
> 0 <- fop_fid
> [then exportfs returns with 89, ENOSYS]
>
> I think I'll try hacking something together in the FUSE kernel module
> to return a value for the VOP_FID call. I guess the best solution
> would be to expose that call to userspace through /dev/fuse (or would
> that break compatibility with existing Linux+BSD fuse implementations?
> Is that important?) but a quick kernel hack will get me started.
>
> Can anybody explain to me why I don't see the call to fop_access or
> fop_fid when I look at the exportfs function in nfs_export.c? I
> expect I'm missing something really basic.
>
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/nfs/nfs_export.c
1126 (*void*) VOP_ACCESS
<http://src.opensolaris.org/source/s?defs=VOP_ACCESS&project=/onnv>(vp, 0, 0,
cr <http://src.opensolaris.org/source/s?defs=cr&project=/onnv>, NULL
<http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>);
...
1149 error = VOP_FID
<http://src.opensolaris.org/source/s?defs=VOP_FID&project=/onnv>(vp, &fid, NULL
<http://src.opensolaris.org/source/s?defs=NULL&project=/onnv>);
...
VOP_ACCESS and VOP_FID are defined as macros.
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/vnode.h
1016 #*define* VOP_ACCESS
<http://src.opensolaris.org/source/s?refs=VOP_ACCESS&project=/onnv>(vp
<http://src.opensolaris.org/source/s?defs=vp&project=/onnv>, mode
<http://src.opensolaris.org/source/s?defs=mode&project=/onnv>, f, cr
<http://src.opensolaris.org/source/s?defs=cr&project=/onnv>, ct
<http://src.opensolaris.org/source/s?defs=ct&project=/onnv>) \
1017 fop_access
<http://src.opensolaris.org/source/s?defs=fop_access&project=/onnv>(vp
<http://src.opensolaris.org/source/s?defs=vp&project=/onnv>, mode
<http://src.opensolaris.org/source/s?defs=mode&project=/onnv>, f, cr
<http://src.opensolaris.org/source/s?defs=cr&project=/onnv>, ct
<http://src.opensolaris.org/source/s?defs=ct&project=/onnv>)
1042 #*define* VOP_FID
<http://src.opensolaris.org/source/s?refs=VOP_FID&project=/onnv>(vp
<http://src.opensolaris.org/source/s?defs=vp&project=/onnv>, fidp
<http://src.opensolaris.org/source/s?defs=fidp&project=/onnv>, ct
<http://src.opensolaris.org/source/s?defs=ct&project=/onnv>) \
1043 fop_fid
<http://src.opensolaris.org/source/s?defs=fop_fid&project=/onnv>(vp
<http://src.opensolaris.org/source/s?defs=vp&project=/onnv>, fidp
<http://src.opensolaris.org/source/s?defs=fidp&project=/onnv>, ct
<http://src.opensolaris.org/source/s?defs=ct&project=/onnv>)
Each filesystem implements the VOP_* interface functions and the kernel code
calls into the filesystem code
via these VOP interfaces.
Pramod
> Thanks,
>
> Russ
>
>
>> --
>> ---
>> frankB
>>
>>
>
> Dtrace script to follow exportfs call:
>
> #!/usr/sbin/dtrace -qs
> #pragma D option flowindent
>
> fbt:nfssrv:exportfs:entry
> {
> self->traceme = 1;
> }
>
> fbt:nfssrv:exportfs:return
> {
> printf( "exportfs retval == %d", args[1] );
> self->traceme = 0;
> }
>
> fbt:::
> /self->traceme == 1/
> {
> printf( "\n" );
> }
> _______________________________________________
> fuse-discuss mailing list
> fuse-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/fuse-discuss
>