mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-05-12 10:15:51 +00:00
NFS: Don't require a filehandle to refresh the inode in nfs_prime_dcache()
If the server does not return a valid set of attributes that we can use to either create a file or refresh the inode, then there is no value in calling nfs_prime_dcache(). However if we're just refreshing the inode using the attributes that the server returned, then it shouldn't matter whether or not we have a filehandle, as long as we check the fsid+fileid combination. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
1ae04b2523
commit
fa9233699c
1 changed files with 13 additions and 3 deletions
14
fs/nfs/dir.c
14
fs/nfs/dir.c
|
@ -408,13 +408,21 @@ static int xdr_decode(nfs_readdir_descriptor_t *desc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Match file and dirent using either filehandle or fileid
|
||||||
|
* Note: caller is responsible for checking the fsid
|
||||||
|
*/
|
||||||
static
|
static
|
||||||
int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry)
|
int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry)
|
||||||
{
|
{
|
||||||
|
struct nfs_inode *nfsi;
|
||||||
|
|
||||||
if (dentry->d_inode == NULL)
|
if (dentry->d_inode == NULL)
|
||||||
goto different;
|
goto different;
|
||||||
if (nfs_compare_fh(entry->fh, NFS_FH(dentry->d_inode)) != 0)
|
|
||||||
goto different;
|
nfsi = NFS_I(dentry->d_inode);
|
||||||
|
if (entry->fattr->fileid == nfsi->fileid)
|
||||||
|
return 1;
|
||||||
|
if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
different:
|
different:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -469,6 +477,8 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
if (!(entry->fattr->valid & NFS_ATTR_FATTR_FILEID))
|
||||||
|
return;
|
||||||
if (!(entry->fattr->valid & NFS_ATTR_FATTR_FSID))
|
if (!(entry->fattr->valid & NFS_ATTR_FATTR_FSID))
|
||||||
return;
|
return;
|
||||||
if (filename.name[0] == '.') {
|
if (filename.name[0] == '.') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue