diff options
author | mm <mm@FreeBSD.org> | 2010-09-14 10:27:32 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2010-09-14 10:27:32 +0000 |
commit | af9e1720ca752925cc004f5ed7ac7ee609ff51f5 (patch) | |
tree | a0553858758217784d118c4030c437a51334d20c /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | |
parent | 6eed5acb736c5555b738654016c586393f5099d3 (diff) | |
download | FreeBSD-src-af9e1720ca752925cc004f5ed7ac7ee609ff51f5.zip FreeBSD-src-af9e1720ca752925cc004f5ed7ac7ee609ff51f5.tar.gz |
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
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c index ab1ba02..156c1ee 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c @@ -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_snapdir = { .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'. * |