Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/nfs Revision 1.118:



details:   https://anonhg.NetBSD.org/src/rev/07dd26031dfb
branches:  netbsd-1-5
changeset: 489480:07dd26031dfb
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Tue Sep 19 18:43:15 2000 +0000

description:
Revision 1.118:
        Fix bug in access cache that might result in permission being denied
        needlessly. From Matthias Drochner.
(approved by thorpej)

diffstat:

 sys/nfs/nfs_vnops.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r bf2b94b8ffdf -r 07dd26031dfb sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c       Tue Sep 19 18:25:19 2000 +0000
+++ b/sys/nfs/nfs_vnops.c       Tue Sep 19 18:43:15 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_vnops.c,v 1.113.4.1 2000/07/30 20:38:57 jdolecek Exp $     */
+/*     $NetBSD: nfs_vnops.c,v 1.113.4.2 2000/09/19 18:43:15 fvdl Exp $ */
 
 /*
  * Copyright (c) 1989, 1993
@@ -314,8 +314,13 @@
         * Check access cache first. If this request has been made for this
         * uid shortly before, use the cached result.
         */
-       if (cachevalid && ((np->n_accmode & ap->a_mode) == ap->a_mode))
-               return np->n_accerror;
+       if (cachevalid) {
+               if (!np->n_accerror) {
+                       if  ((np->n_accmode & ap->a_mode) == ap->a_mode)
+                               return np->n_accerror;
+               } else if ((np->n_accmode & ap->a_mode) == np->n_accmode)
+                       return np->n_accerror;
+       }
 
        /*
         * For nfs v3, do an access rpc, otherwise you are stuck emulating
@@ -386,9 +391,12 @@
                 * different request, OR it in. Don't update
                 * the timestamp in that case.
                 */
-               if (cachevalid && error == np->n_accerror)
-                       np->n_accmode |= ap->a_mode;
-               else {
+               if (cachevalid && error == np->n_accerror) {
+                       if (!error)
+                               np->n_accmode |= ap->a_mode;
+                       else if ((np->n_accmode & ap->a_mode) == ap->a_mode)
+                               np->n_accmode = ap->a_mode;
+               } else {
                        np->n_accstamp = time.tv_sec;
                        np->n_accuid = ap->a_cred->cr_uid;
                        np->n_accmode = ap->a_mode;



Home | Main Index | Thread Index | Old Index