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
This commit is contained in:
Martin Matuska 2010-09-14 10:27:32 +00:00
parent 9aff0c8ff7
commit 4eeef2e44a

View File

@ -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'.
*