Hi,
When I tested xfstest/generic/426 with NFSv4.0, it failed..
The test steps are as follows:
1. Use name_to_handle_at() to change the filename to filehandle.
2. Execute "echo 3 > /proc/sys/vm/drop_caches".
3. Use open_by_handle_at() to open files with the filehandle created
bystep 1.
Step 3 calls nfs_fh_to_dentry() to convert the filehandle to dentry.
But because the inode and dentry cache information was deleted in step
2, a new inode is generated using the nfs_fhget().
And then a new dentry is generated using the d_obtain_alias().
However, during the call to the d_obtain_alias() function, the d_iname
of the dentry is assigned the slash_name"/".
Nfsd will check the dentry's d_iname, when open claim type is
NFS4_OPEN_CLAIM_NULL.
So when dentry's d_inameis "/", it fails with the error "nfserr_badname"
So I want to know why the newly created dentry is named "/",
and when using open_by_handle_at() to open a file, is it possible to set
the claim type to NFS4_OPEN_CLAIM_PREVIOUS ?
Thanks,
cuiyue
On Wed, 2019-02-20 at 17:38 +0800, Cui, Yue/崔 悦 wrote:
> Hi,
>
> When I tested xfstest/generic/426 with NFSv4.0, it failed..
>
> The test steps are as follows:
>
> 1. Use name_to_handle_at() to change the filename to filehandle.
>
> 2. Execute "echo 3 > /proc/sys/vm/drop_caches".
>
> 3. Use open_by_handle_at() to open files with the filehandle created
> bystep 1.
>
> Step 3 calls nfs_fh_to_dentry() to convert the filehandle to dentry.
>
> But because the inode and dentry cache information was deleted in
> step
> 2, a new inode is generated using the nfs_fhget().
>
> And then a new dentry is generated using the d_obtain_alias().
>
> However, during the call to the d_obtain_alias() function, the
> d_iname
> of the dentry is assigned the slash_name"/".
>
> Nfsd will check the dentry's d_iname, when open claim type is
> NFS4_OPEN_CLAIM_NULL.
>
> So when dentry's d_inameis "/", it fails with the error
> "nfserr_badname"
>
> So I want to know why the newly created dentry is named "/",
>
> and when using open_by_handle_at() to open a file, is it possible to
> set
> the claim type to NFS4_OPEN_CLAIM_PREVIOUS ?
That would break NFSv4.0 support.
Servers are expected to return NFS4ERR_NO_GRACE if you try to use
NFS4_OPEN_CLAIM_PREVIOUS in a situation that does not involve reboot
recovery. Most of them also rely on clients not abusing reclaim
operations to obtain new share locks when the server is in the grace
period.
The issue is that NFSv4.0 has no reliable support for open by
filehandle. That concept was first introduced in NFSv4.1 with the
'CLAIM_FH' argument (see
https://tools.ietf.org/html/rfc5661#section-18.16.3 ).
Cheers
Trond
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]