Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs Fix bug in access cache that might result in permiss...



details:   https://anonhg.NetBSD.org/src/rev/57a458b0b8cd
branches:  trunk
changeset: 497090:57a458b0b8cd
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Tue Sep 19 00:00:18 2000 +0000

description:
Fix bug in access cache that might result in permission being denied
needlessly. From Matthias Drochner.

diffstat:

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

diffs (41 lines):

diff -r a4f72b6a13e1 -r 57a458b0b8cd sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c       Mon Sep 18 22:18:00 2000 +0000
+++ b/sys/nfs/nfs_vnops.c       Tue Sep 19 00:00:18 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_vnops.c,v 1.117 2000/08/03 20:41:33 thorpej Exp $  */
+/*     $NetBSD: nfs_vnops.c,v 1.118 2000/09/19 00:00:18 fvdl Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -312,8 +312,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
@@ -384,9 +389,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