Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs Get locking in rmdir right. Don't unlock a vnode whe...



details:   https://anonhg.NetBSD.org/src/rev/e0b17f852527
branches:  trunk
changeset: 503450:e0b17f852527
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Tue Feb 06 15:26:25 2001 +0000

description:
Get locking in rmdir right. Don't unlock a vnode when passing its
associated nfsnode to nfs_lookitup, it is not needed, and fixes
nfs_remove.

diffstat:

 sys/nfs/nfs_vnops.c |  25 ++++---------------------
 1 files changed, 4 insertions(+), 21 deletions(-)

diffs (62 lines):

diff -r d21c34a7f83c -r e0b17f852527 sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c       Tue Feb 06 13:13:42 2001 +0000
+++ b/sys/nfs/nfs_vnops.c       Tue Feb 06 15:26:25 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_vnops.c,v 1.128 2001/02/06 11:40:02 fvdl Exp $     */
+/*     $NetBSD: nfs_vnops.c,v 1.129 2001/02/06 15:26:25 fvdl Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -2005,7 +2005,7 @@
 
        if (dvp == vp) {
                vrele(dvp);
-               vrele(dvp);
+               vput(dvp);
                PNBUF_PUT(cnp->cn_pnbuf);
                return (EINVAL);
        }
@@ -2024,8 +2024,8 @@
                VTONFS(dvp)->n_attrstamp = 0;
        cache_purge(dvp);
        cache_purge(vp);
-       vrele(vp);
-       vrele(dvp);
+       vput(vp);
+       vput(dvp);
        /*
         * Kludge: Map ENOENT => 0 assuming that you have a reply to a retry.
         */
@@ -2567,7 +2567,6 @@
 {
        struct sillyrename *sp;
        struct nfsnode *np;
-       struct vnode *newvp;
        int error;
        short pid;
 
@@ -2604,24 +2603,8 @@
        error = nfs_renameit(dvp, cnp, sp);
        if (error)
                goto bad;
-       VOP_UNLOCK(vp, 0);
        error = nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
                cnp->cn_proc, &np);
-       newvp = NFSTOV(np);
-       if (newvp != vp) {
-               /*
-                * XXX. If the server decides to change the handle
-                * because of the rename, we're screwed. This is
-                * "strongly discouraged" in the spec, but not
-                * forbidden. Should just get a new nfsnode and
-                * associate it with the vnode in this case.
-                */
-               vput(newvp);
-               vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-               error = EINVAL;
-               goto bad;
-       } else
-               vrele(vp);
        np->n_sillyrename = sp;
        return (0);
 bad:



Home | Main Index | Thread Index | Old Index