Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs nfsrv_lookup(): Defer the postopattr lookup on dirp ...



details:   https://anonhg.NetBSD.org/src/rev/b673e91bbf1b
branches:  trunk
changeset: 771452:b673e91bbf1b
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Nov 21 09:07:59 2011 +0000

description:
nfsrv_lookup(): Defer the postopattr lookup on dirp until the
                child node is unlocked.

Ok: YAMAMOTO Takashi <yamt%netbsd.org@localhost>

diffstat:

 sys/nfs/nfs_serv.c |  29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diffs (64 lines):

diff -r 7ba4af2bc178 -r b673e91bbf1b sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c        Mon Nov 21 08:23:20 2011 +0000
+++ b/sys/nfs/nfs_serv.c        Mon Nov 21 09:07:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_serv.c,v 1.161 2011/10/30 12:00:27 hannken Exp $   */
+/*     $NetBSD: nfs_serv.c,v 1.162 2011/11/21 09:07:59 hannken Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.161 2011/10/30 12:00:27 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.162 2011/11/21 09:07:59 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -453,15 +453,6 @@
                }
        }
 
-       if (dirp) {
-               if (v3) {
-                       vn_lock(dirp, LK_SHARED | LK_RETRY);
-                       dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred);
-                       VOP_UNLOCK(dirp);
-               }
-               vrele(dirp);
-       }
-
        if (error) {
                if (nd.ni_pathbuf != NULL) {
                        pathbuf_destroy(nd.ni_pathbuf);
@@ -469,6 +460,14 @@
                if (ipb != NULL) {
                        pathbuf_destroy(ipb);
                }
+               if (dirp) {
+                       if (v3) {
+                               vn_lock(dirp, LK_SHARED | LK_RETRY);
+                               dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred);
+                               vput(dirp);
+                       } else
+                               vrele(dirp);
+               }
                nfsm_reply(NFSX_POSTOPATTR(v3));
                nfsm_srvpostop_attr(dirattr_ret, &dirattr);
                return (0);
@@ -484,6 +483,14 @@
        if (!error)
                error = VOP_GETATTR(vp, &va, cred);
        vput(vp);
+       if (dirp) {
+               if (v3) {
+                       vn_lock(dirp, LK_SHARED | LK_RETRY);
+                       dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred);
+                       vput(dirp);
+               } else
+                       vrele(dirp);
+       }
        nfsm_reply(NFSX_SRVFH(&nsfh, v3) + NFSX_POSTOPORFATTR(v3) +
            NFSX_POSTOPATTR(v3));
        if (error) {



Home | Main Index | Thread Index | Old Index