Author: kib
Date: Tue Sep  8 09:17:34 2009
New Revision: 196966
URL: http://svn.freebsd.org/changeset/base/196966

Log:
  Lock Giant around vn_open_cred().
  Remove innocent unnecessary call to NDFREE().
  
  Reported by:  marcel
  Reviewed and tested by:       pjd
  MFC after:    3 days

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c    Tue Sep  8 
08:54:15 2009        (r196965)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c    Tue Sep  8 
09:17:34 2009        (r196966)
@@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file)
        struct thread *td = curthread;
        struct filedesc *fd;
        struct nameidata nd;
-       int error, flags;
+       int error, flags, vfslocked;
 
        fd = td->td_proc->p_fd;
        FILEDESC_XLOCK(fd);
@@ -86,11 +86,13 @@ kobj_open_file_vnode(const char *file)
        flags = FREAD | O_NOFOLLOW;
        NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
        error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
-       NDFREE(&nd, NDF_ONLY_PNBUF);
        if (error != 0)
                return (NULL);
+       vfslocked = NDHASGIANT(&nd);
+       NDFREE(&nd, NDF_ONLY_PNBUF);
        /* We just unlock so we hold a reference. */
        VOP_UNLOCK(nd.ni_vp, 0);
+       VFS_UNLOCK_GIANT(vfslocked);
        return (nd.ni_vp);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to