Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't namei while holding vnode lock. kern/43328



details:   https://anonhg.NetBSD.org/src/rev/4e602b82580d
branches:  trunk
changeset: 755058:4e602b82580d
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri May 21 16:48:55 2010 +0000

description:
Don't namei while holding vnode lock.  kern/43328

diffstat:

 sys/kern/vfs_xattr.c |  24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diffs (60 lines):

diff -r 03766e4bef02 -r 4e602b82580d sys/kern/vfs_xattr.c
--- a/sys/kern/vfs_xattr.c      Fri May 21 16:47:45 2010 +0000
+++ b/sys/kern/vfs_xattr.c      Fri May 21 16:48:55 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_xattr.c,v 1.20 2009/06/29 05:08:18 dholland Exp $  */
+/*     $NetBSD: vfs_xattr.c,v 1.21 2010/05/21 16:48:55 pooka Exp $     */
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.20 2009/06/29 05:08:18 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.21 2010/05/21 16:48:55 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -161,32 +161,30 @@
                        return (error);
        }
 
+       error = namei_simple_user(SCARG(uap, path),
+                               NSM_FOLLOW_NOEMULROOT, &path_vp);
+       if (error) {
+               return (error);
+       }
+
        file_vp = NULL;
        if (SCARG(uap, filename) != NULL) {
                NDINIT(&file_nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
                    SCARG(uap, filename));
                error = namei(&file_nd);
-               if (error)
+               if (error) {
+                       vrele(path_vp);
                        return (error);
+               }
                file_vp = file_nd.ni_vp;
        }
 
-       error = namei_simple_user(SCARG(uap, path),
-                               NSM_FOLLOW_NOEMULROOT, &path_vp);
-       if (error) {
-               if (file_vp != NULL)
-                       vput(file_vp);
-               return (error);
-       }
-
        error = VFS_EXTATTRCTL(path_vp->v_mount, SCARG(uap, cmd), file_vp,
            SCARG(uap, attrnamespace),
            SCARG(uap, attrname) != NULL ? attrname : NULL);
 
        if (file_vp != NULL)
                vrele(file_vp);
-
-       /* XXX missing in the original code - am *I* missing something? */
        vrele(path_vp);
 
        return (error);



Home | Main Index | Thread Index | Old Index