Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 May 2009 15:01:50 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r193176 - head/sys/fs/pseudofs
Message-ID:  <200905311501.n4VF1on1047097@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun May 31 15:01:50 2009
New Revision: 193176
URL: http://svn.freebsd.org/changeset/base/193176

Log:
  Unlock the pseudofs vnode before calling fill method for pfs_readlink().
  The fill code may need to lock another vnode, e.g. procfs file
  implementation.
  
  Reviewed by:	des
  Tested by:	pho
  MFC after:	2 weeks

Modified:
  head/sys/fs/pseudofs/pseudofs_vnops.c

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vnops.c	Sun May 31 14:58:43 2009	(r193175)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c	Sun May 31 15:01:50 2009	(r193176)
@@ -827,7 +827,7 @@ pfs_readlink(struct vop_readlink_args *v
 	struct proc *proc = NULL;
 	char buf[PATH_MAX];
 	struct sbuf sb;
-	int error;
+	int error, locked;
 
 	PFS_TRACE(("%s", pn->pn_name));
 	pfs_assert_not_owned(pn);
@@ -849,6 +849,9 @@ pfs_readlink(struct vop_readlink_args *v
 		_PHOLD(proc);
 		PROC_UNLOCK(proc);
 	}
+	vhold(vn);
+	locked = VOP_ISLOCKED(vn);
+	VOP_UNLOCK(vn, 0);
 
 	/* sbuf_new() can't fail with a static buffer */
 	sbuf_new(&sb, buf, sizeof buf, 0);
@@ -857,6 +860,8 @@ pfs_readlink(struct vop_readlink_args *v
 
 	if (proc != NULL)
 		PRELE(proc);
+	vn_lock(vn, locked | LK_RETRY);
+	vdrop(vn);
 
 	if (error) {
 		sbuf_delete(&sb);



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