summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_vnops.c
diff options
context:
space:
mode:
authormohans <mohans@FreeBSD.org>2007-03-09 04:02:38 +0000
committermohans <mohans@FreeBSD.org>2007-03-09 04:02:38 +0000
commita332cb00d57e6d307a6d08a69b4d5430b20c7850 (patch)
tree24b2e714c624eb1b06a4af38fe8eb04bc9f63660 /sys/nfsclient/nfs_vnops.c
parent088212ae5d87f38b2e7890e8e1a608a268db0add (diff)
downloadFreeBSD-src-a332cb00d57e6d307a6d08a69b4d5430b20c7850.zip
FreeBSD-src-a332cb00d57e6d307a6d08a69b4d5430b20c7850.tar.gz
Over NFS, an open() call could result in multiple over-the-wire
GETATTRs being generated - one from lookup()/namei() and the other from nfs_open() (for cto consistency). This change eliminates the GETATTR in nfs_open() if an otw GETATTR was done from the namei() path. Instead of extending the vop interface, we timestamp each attr load, and use this to detect whether a GETATTR was done from namei() for this syscall. Introduces a thread-local variable that counts the syscalls made by the thread and uses <pid, tid, thread syscalls> as the attrload timestamp. Thanks to jhb@ and peter@ for a discussion on thread state that could be used as the timestamp with minimal overhead.
Diffstat (limited to 'sys/nfsclient/nfs_vnops.c')
-rw-r--r--sys/nfsclient/nfs_vnops.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index 761618b..55d7b3f 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -432,6 +432,8 @@ nfs_access(struct vop_access_args *ap)
}
}
+int nfs_otw_getattr_avoid = 0;
+
/*
* nfs open vnode op
* Check to see if the type is ok
@@ -471,7 +473,14 @@ nfs_open(struct vop_open_args *ap)
np->n_mtime = vattr.va_mtime;
mtx_unlock(&np->n_mtx);
} else {
- np->n_attrstamp = 0;
+ 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;
+ }
mtx_unlock(&np->n_mtx);
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
if (error)
OpenPOWER on IntegriCloud