diff options
author | peter <peter@FreeBSD.org> | 1998-11-02 02:36:16 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-11-02 02:36:16 +0000 |
commit | e268ff150f32833ee833e36a07cc3837ca3f63c1 (patch) | |
tree | aa325830b87b3e98dabf3eec33f133c0e3b491b4 /sys/kern | |
parent | 7f75b60ff72c53340c909c11f916e63201f46c99 (diff) | |
download | FreeBSD-src-e268ff150f32833ee833e36a07cc3837ca3f63c1.zip FreeBSD-src-e268ff150f32833ee833e36a07cc3837ca3f63c1.tar.gz |
Only do one VOP_ACCESS() per open() instead of two. This should reduce
the NFSv3 ACCESS RPC problems a little for busy clients that do a lot of
open/close. The nfs code could probably cache the results, but I'm not
sure whether this would be legal or useful. The problem is that with
a CPU farm, on each open there would be a lookup, getattr then access RPC
then the read/write RPC activity. Caching the access results probably
isn't going to help much if the clients access lots of files. Having the
nfs_access() routine interpret the getattr results is a bit of a hack, but
it's how NFSv2 is done and it might be OK for a mount attribute for v3.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_vnops.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 41e8cbb..2b73bcc 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 - * $Id: vfs_vnops.c,v 1.58 1998/06/07 17:11:48 dfr Exp $ + * $Id: vfs_vnops.c,v 1.59 1998/06/27 06:43:09 phk Exp $ */ #include <sys/param.h> @@ -78,7 +78,7 @@ vn_open(ndp, fmode, cmode) register struct ucred *cred = p->p_ucred; struct vattr vat; struct vattr *vap = &vat; - int error; + int mode, error; if (fmode & O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; @@ -136,11 +136,7 @@ vn_open(ndp, fmode, cmode) goto bad; } if ((fmode & O_CREAT) == 0) { - if (fmode & FREAD) { - error = VOP_ACCESS(vp, VREAD, cred, p); - if (error) - goto bad; - } + mode = 0; if (fmode & (FWRITE | O_TRUNC)) { if (vp->v_type == VDIR) { error = EISDIR; @@ -149,7 +145,12 @@ vn_open(ndp, fmode, cmode) error = vn_writechk(vp); if (error) goto bad; - error = VOP_ACCESS(vp, VWRITE, cred, p); + mode |= VWRITE; + } + if (fmode & FREAD) + mode |= VREAD; + if (mode) { + error = VOP_ACCESS(vp, mode, cred, p); if (error) goto bad; } |