Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Sep 2010 10:27:32 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r212605 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201009141027.o8EARW73075670@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mm
Date: Tue Sep 14 10:27:32 2010
New Revision: 212605
URL: http://svn.freebsd.org/changeset/base/212605

Log:
  Add missing vop_vector zfsctl_ops_shares
  Add missing locks around VOP_READDIR and VOP_GETATTR with z_shares_dir
  
  PR:		kern/150544
  Approved by:	delphij (mentor)
  Obtained from:	perforce (pjd)
  MFC after:	1 day

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	Tue Sep 14 10:26:49 2010	(r212604)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	Tue Sep 14 10:27:32 2010	(r212605)
@@ -1101,8 +1101,9 @@ zfsctl_shares_readdir(ap)
 		return (ENOTSUP);
 	}
 	if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
+		vn_lock(ZTOV(dzp), LK_SHARED | LK_RETRY);
 		error = VOP_READDIR(ZTOV(dzp), uiop, cr, eofp, ap->a_ncookies, ap->a_cookies);
-		VN_RELE(ZTOV(dzp));
+		VN_URELE(ZTOV(dzp));
 	} else {
 		*eofp = 1;
 		error = ENOENT;
@@ -1149,6 +1150,7 @@ zfsctl_mknode_shares(vnode_t *pvp)
 	    NULL, NULL);
 	sdp = vp->v_data;
 	sdp->zc_cmtime = ((zfsctl_node_t *)pvp->v_data)->zc_cmtime;
+	VOP_UNLOCK(vp, 0);
 	return (vp);
 
 }
@@ -1176,8 +1178,9 @@ zfsctl_shares_getattr(ap)
 		return (ENOTSUP);
 	}
 	if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
+		vn_lock(ZTOV(dzp), LK_SHARED | LK_RETRY);
 		error = VOP_GETATTR(ZTOV(dzp), vap, cr);
-		VN_RELE(ZTOV(dzp));
+		VN_URELE(ZTOV(dzp));
 	}
 	ZFS_EXIT(zfsvfs);
 	return (error);
@@ -1253,6 +1256,20 @@ static struct vop_vector zfsctl_ops_snap
 	.vop_fid =	zfsctl_common_fid,
 };
 
+static struct vop_vector zfsctl_ops_shares = {
+	.vop_default =	&default_vnodeops,
+	.vop_open =	zfsctl_common_open,
+	.vop_close =	zfsctl_common_close,
+	.vop_ioctl =	VOP_EINVAL,
+	.vop_getattr =	zfsctl_shares_getattr,
+	.vop_access =	zfsctl_common_access,
+	.vop_readdir =	zfsctl_shares_readdir,
+	.vop_lookup =	zfsctl_shares_lookup,
+	.vop_inactive =	gfs_vop_inactive,
+	.vop_reclaim =	zfsctl_common_reclaim,
+	.vop_fid =	zfsctl_shares_fid,
+};
+
 /*
  * pvp is the GFS vnode '.zfs/snapshot'.
  *



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