Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs in nfs_open(), initialize the write creds if we're o...



details:   https://anonhg.NetBSD.org/src/rev/aba79d4af48d
branches:  trunk
changeset: 499815:aba79d4af48d
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Nov 30 07:24:12 2000 +0000

description:
in nfs_open(), initialize the write creds if we're opening for writing.
otherwise we would never set them if we only modify the file via mmap().

diffstat:

 sys/nfs/nfs_vnops.c |  19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (40 lines):

diff -r d25a0eab279b -r aba79d4af48d sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c       Thu Nov 30 06:59:08 2000 +0000
+++ b/sys/nfs/nfs_vnops.c       Thu Nov 30 07:24:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_vnops.c,v 1.124 2000/11/27 08:39:51 chs Exp $      */
+/*     $NetBSD: nfs_vnops.c,v 1.125 2000/11/30 07:24:12 chs Exp $      */
 
 /*
  * Copyright (c) 1989, 1993
@@ -439,6 +439,19 @@
                return (EACCES);
        }
 
+       /*
+        * if we're opening with write access, initialize the write creds
+        * in case we only write via memory mappings.
+        */
+
+       if (ap->a_mode & FWRITE) {
+               if (np->n_wcred) {
+                       crfree(np->n_wcred);
+               }
+               np->n_wcred = ap->a_cred;
+               crhold(np->n_wcred);
+       }
+
 #ifndef NFS_V2_ONLY
        /*
         * Get a valid lease. If cached data is stale, flush it.
@@ -1100,6 +1113,10 @@
        const int v3 = NFS_ISV3(vp);
        int committed = NFSV3WRITE_FILESYNC;
 
+       if (vp->v_mount->mnt_flag & MNT_RDONLY) {
+               panic("writerpc readonly vp %p", vp);
+       }
+
 #ifndef DIAGNOSTIC
        if (uiop->uio_iovcnt != 1)
                panic("nfs: writerpc iovcnt > 1");



Home | Main Index | Thread Index | Old Index