Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Feb 2009 18:18:14 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188588 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs compat/linux compat/svr4 fs/coda i386/ibcs2 kern nfsserver
Message-ID:  <200902131818.n1DIIEll095652@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Feb 13 18:18:14 2009
New Revision: 188588
URL: http://svn.freebsd.org/changeset/base/188588

Log:
  Use shared vnode locks when invoking VOP_READDIR().
  
  MFC after:	1 month

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/compat/linux/linux_file.c
  head/sys/compat/linux/linux_getcwd.c
  head/sys/compat/svr4/svr4_misc.c
  head/sys/fs/coda/coda_vnops.c
  head/sys/i386/ibcs2/ibcs2_misc.c
  head/sys/kern/vfs_syscalls.c
  head/sys/nfsserver/nfs_serv.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -4697,8 +4697,8 @@ vop_listextattr {
 		return (error);
 	}
 
-	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | MPSAFE, UIO_SYSSPACE,
-	    ".", xvp, td);
+	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED | MPSAFE,
+	    UIO_SYSSPACE, ".", xvp, td);
 	error = namei(&nd);
 	vp = nd.ni_vp;
 	NDFREE(&nd, NDF_ONLY_PNBUF);

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/compat/linux/linux_file.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -372,7 +372,7 @@ getdents_common(struct thread *td, struc
 	buflen = min(buflen, MAXBSIZE);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
 	lbuf = malloc(LINUX_MAXRECLEN, M_TEMP, M_WAITOK | M_ZERO);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 
 again:
 	aiov.iov_base = buf;

Modified: head/sys/compat/linux/linux_getcwd.c
==============================================================================
--- head/sys/compat/linux/linux_getcwd.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/compat/linux/linux_getcwd.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -163,7 +163,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bu
 	cn.cn_nameptr = "..";
 	cn.cn_namelen = 2;
 	cn.cn_consume = 0;
-	cn.cn_lkflags = LK_EXCLUSIVE;
+	cn.cn_lkflags = LK_SHARED;
 	
 	/*
 	 * At this point, lvp is locked and will be unlocked by the lookup.

Modified: head/sys/compat/svr4/svr4_misc.c
==============================================================================
--- head/sys/compat/svr4/svr4_misc.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/compat/svr4/svr4_misc.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -278,7 +278,7 @@ svr4_sys_getdents64(td, uap)
 	buflen = max(DIRBLKSIZ, nbytes);
 	buflen = min(buflen, MAXBSIZE);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 again:
 	aiov.iov_base = buf;
 	aiov.iov_len = buflen;
@@ -447,7 +447,7 @@ svr4_sys_getdents(td, uap)
 
 	buflen = min(MAXBSIZE, uap->nbytes);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 	off = fp->f_offset;
 again:
 	aiov.iov_base = buf;

Modified: head/sys/fs/coda/coda_vnops.c
==============================================================================
--- head/sys/fs/coda/coda_vnops.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/fs/coda/coda_vnops.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -1506,7 +1506,7 @@ coda_readdir(struct vop_readdir_args *ap
 	 */
 	CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = %s, "
 	    "refcnt = %d\n", coda_f2s(&cp->c_fid), vp->v_usecount)););
-	vn_lock(cp->c_ovp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(cp->c_ovp, LK_SHARED | LK_RETRY);
 	error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies,
 	    cookies);
 	VOP_UNLOCK(cp->c_ovp, 0);

Modified: head/sys/i386/ibcs2/ibcs2_misc.c
==============================================================================
--- head/sys/i386/ibcs2/ibcs2_misc.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/i386/ibcs2/ibcs2_misc.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -356,7 +356,7 @@ ibcs2_getdents(td, uap)
 	buflen = max(DIRBLKSIZ, uap->nbytes);
 	buflen = min(buflen, MAXBSIZE);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 again:
 	aiov.iov_base = buf;
 	aiov.iov_len = buflen;
@@ -518,7 +518,7 @@ ibcs2_read(td, uap)
 	buflen = max(DIRBLKSIZ, uap->nbytes);
 	buflen = min(buflen, MAXBSIZE);
 	buf = malloc(buflen, M_TEMP, M_WAITOK);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 again:
 	aiov.iov_base = buf;
 	aiov.iov_len = buflen;

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/kern/vfs_syscalls.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -3936,7 +3936,7 @@ unionread:
 	auio.uio_segflg = UIO_USERSPACE;
 	auio.uio_td = td;
 	auio.uio_resid = uap->count;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 	loff = auio.uio_offset = fp->f_offset;
 #ifdef MAC
 	error = mac_vnode_check_readdir(td->td_ucred, vp);
@@ -4095,8 +4095,7 @@ unionread:
 	auio.uio_segflg = UIO_USERSPACE;
 	auio.uio_td = td;
 	auio.uio_resid = count;
-	/* vn_lock(vp, LK_SHARED | LK_RETRY); */
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 	AUDIT_ARG(vnode, vp, ARG_VNODE1);
 	loff = auio.uio_offset = fp->f_offset;
 #ifdef MAC

Modified: head/sys/nfsserver/nfs_serv.c
==============================================================================
--- head/sys/nfsserver/nfs_serv.c	Fri Feb 13 18:09:38 2009	(r188587)
+++ head/sys/nfsserver/nfs_serv.c	Fri Feb 13 18:18:14 2009	(r188588)
@@ -3251,7 +3251,7 @@ again:
 	io.uio_rw = UIO_READ;
 	io.uio_td = NULL;
 	eofflag = 0;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 	if (cookies) {
 		free((caddr_t)cookies, M_TEMP);
 		cookies = NULL;
@@ -3533,7 +3533,7 @@ again:
 	io.uio_rw = UIO_READ;
 	io.uio_td = NULL;
 	eofflag = 0;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 	if (cookies) {
 		free((caddr_t)cookies, M_TEMP);
 		cookies = NULL;



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