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.
This commit is contained in:
parent
9184fb847b
commit
f3d6ee090e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40815
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user