aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient/nfs_vnops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/nfsclient/nfs_vnops.c')
-rw-r--r--sys/nfsclient/nfs_vnops.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index 575997cc39ce..f3323f960759 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -538,15 +538,6 @@ nfs_open(struct vop_open_args *ap)
np->n_mtime = vattr.va_mtime;
mtx_unlock(&np->n_mtx);
} else {
- struct thread *td = curthread;
-
- if (np->n_ac_ts_syscalls != td->td_syscalls ||
- np->n_ac_ts_tid != td->td_tid ||
- td->td_proc == NULL ||
- np->n_ac_ts_pid != td->td_proc->p_pid) {
- np->n_attrstamp = 0;
- KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
- }
mtx_unlock(&np->n_mtx);
error = VOP_GETATTR(vp, &vattr, ap->a_cred);
if (error)
@@ -1123,6 +1114,20 @@ nfs_lookup(struct vop_lookup_args *ap)
return (error);
}
newvp = NFSTOV(np);
+
+ /*
+ * Flush the attribute cache when opening a leaf node
+ * to ensure that fresh attributes are fetched in
+ * nfs_open() if we are unable to fetch attributes
+ * from the LOOKUP reply.
+ */
+ if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) &&
+ !(np->n_flag & NMODIFIED)) {
+ mtx_lock(&np->n_mtx);
+ np->n_attrstamp = 0;
+ KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp);
+ mtx_unlock(&np->n_mtx);
+ }
}
if (v3) {
nfsm_postop_attr(newvp, attrflag);