When a stale file handle is encountered, purge all cached information about
an NFS node including the access and attribute caches. Previously the NFS client only purged any name cache entries associated with the file. PR: kern/123755 Submitted by: Jaakko Heinonen jh of saunalahti fi Reported by: Timo Sirainen tss of iki fi Reviewed by: rwatson, rmacklem MFC after: 1 month
This commit is contained in:
parent
6e57ff1890
commit
3429118095
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190785
@ -259,7 +259,7 @@ nfs4_request(struct vnode *vp, struct mbuf *mrest, int procnum,
|
||||
** lookup cache, just in case.
|
||||
**/
|
||||
if (error == ESTALE)
|
||||
cache_purge(vp);
|
||||
nfs_purgecache(vp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
@ -322,6 +322,7 @@ void nfs_down(struct nfsreq *, struct nfsmount *, struct thread *,
|
||||
#endif /* ! NFS4_USE_RPCCLNT */
|
||||
#endif
|
||||
|
||||
void nfs_purgecache(struct vnode *);
|
||||
int nfs_vinvalbuf(struct vnode *, int, struct thread *, int);
|
||||
int nfs_readrpc(struct vnode *, struct uio *, struct ucred *);
|
||||
int nfs_writerpc(struct vnode *, struct uio *, struct ucred *, int *,
|
||||
|
@ -557,7 +557,7 @@ nfs_request(struct vnode *vp, struct mbuf *mreq, int procnum,
|
||||
* cache, just in case.
|
||||
*/
|
||||
if (error == ESTALE)
|
||||
cache_purge(vp);
|
||||
nfs_purgecache(vp);
|
||||
/*
|
||||
* Skip wcc data on NFS errors for now. NetApp filers
|
||||
* return corrupt postop attrs in the wcc data for NFS
|
||||
|
@ -1364,7 +1364,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
|
||||
* lookup cache, just in case.
|
||||
*/
|
||||
if (error == ESTALE)
|
||||
cache_purge(vp);
|
||||
nfs_purgecache(vp);
|
||||
/*
|
||||
* Skip wcc data on NFS errors for now. NetApp filers return corrupt
|
||||
* postop attrs in the wcc data for NFS err EROFS. Not sure if they
|
||||
|
@ -865,6 +865,29 @@ nfs_getattrcache(struct vnode *vp, struct vattr *vaper)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Purge all cached information about an NFS vnode including name
|
||||
* cache entries, the attribute cache, and the access cache. This is
|
||||
* called when an NFS request for a node fails with a stale
|
||||
* filehandle.
|
||||
*/
|
||||
void
|
||||
nfs_purgecache(struct vnode *vp)
|
||||
{
|
||||
struct nfsnode *np;
|
||||
int i;
|
||||
|
||||
np = VTONFS(vp);
|
||||
cache_purge(vp);
|
||||
mtx_lock(&np->n_mtx);
|
||||
np->n_attrstamp = 0;
|
||||
KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
|
||||
for (i = 0; i < NFS_ACCESSCACHESIZE; i++)
|
||||
np->n_accesscache[i].stamp = 0;
|
||||
KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp);
|
||||
mtx_unlock(&np->n_mtx);
|
||||
}
|
||||
|
||||
static nfsuint64 nfs_nullcookie = { { 0, 0 } };
|
||||
/*
|
||||
* This function finds the directory cookie that corresponds to the
|
||||
|
Loading…
Reference in New Issue
Block a user