Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 2009 12:56:13 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r197087 - in stable/8/sys: . amd64/include/xen cddl/compat/opensolaris/kern cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci
Message-ID:  <200909111256.n8BCuD0X052680@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Sep 11 12:56:13 2009
New Revision: 197087
URL: http://svn.freebsd.org/changeset/base/197087

Log:
  MFC r196966:
  Lock Giant around vn_open_cred().
  Remove innocent unnecessary call to NDFREE().
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
==============================================================================
--- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	Fri Sep 11 11:42:56 2009	(r197086)
+++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	Fri Sep 11 12:56:13 2009	(r197087)
@@ -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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909111256.n8BCuD0X052680>