diff options
author | delphij <delphij@FreeBSD.org> | 2013-08-28 00:39:47 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2013-08-28 00:39:47 +0000 |
commit | f30d83113718ef96a9eb0fcbdb4ac60b47dda665 (patch) | |
tree | c4c66a85c101276d5b18785b668131dd6abed1e4 | |
parent | 1d2edd950568843a7238654f4985ce930d827ceb (diff) | |
download | FreeBSD-src-f30d83113718ef96a9eb0fcbdb4ac60b47dda665.zip FreeBSD-src-f30d83113718ef96a9eb0fcbdb4ac60b47dda665.tar.gz |
Previously, both zfs_rename and zfs_link does a check on whether
the passed vnode belongs to the same mount point (v_vfsp or also
known as v_mount in FreeBSD). This check prevents the code from
proceeding further on vnodes that do not belong to ZFS, for
instance, on UFS or NULLFS.
The recent change (merged as r254585) on upstream changes the
check of v_vfsp to instead check the znode's z_zfsvfs. On Illumos
this would work because when the vnode comes from lofs, the
VOP_REALVP() would give the right vnode, this is not true on
FreeBSD where our VOP_REALVP is a no-op, and as such tdvp is
not guaranteed to be a ZFS vnode, and will later trigger a
failed assertion when verifying the vnode.
This changeset modifies our local shims (zfs_freebsd_rename and
zfs_freebsd_link) to check if v_mount matches before proceeding
further.
Reported by: many
Diagnostic work by: avg
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index a23dd0d..2716c25 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -6250,8 +6250,11 @@ zfs_freebsd_rename(ap) ASSERT(ap->a_fcnp->cn_flags & (SAVENAME|SAVESTART)); ASSERT(ap->a_tcnp->cn_flags & (SAVENAME|SAVESTART)); - error = zfs_rename(fdvp, ap->a_fcnp->cn_nameptr, tdvp, - ap->a_tcnp->cn_nameptr, ap->a_fcnp->cn_cred, NULL, 0); + if (fdvp->v_mount == tdvp->v_mount) + error = zfs_rename(fdvp, ap->a_fcnp->cn_nameptr, tdvp, + ap->a_tcnp->cn_nameptr, ap->a_fcnp->cn_cred, NULL, 0); + else + error = EXDEV; if (tdvp == tvp) VN_RELE(tdvp); @@ -6308,10 +6311,15 @@ zfs_freebsd_link(ap) } */ *ap; { struct componentname *cnp = ap->a_cnp; + vnode_t *vp = ap->a_vp; + vnode_t *tdvp = ap->a_tdvp; + + if (tdvp->v_mount != vp->v_mount) + return (EXDEV); ASSERT(cnp->cn_flags & SAVENAME); - return (zfs_link(ap->a_tdvp, ap->a_vp, cnp->cn_nameptr, cnp->cn_cred, NULL, 0)); + return (zfs_link(tdvp, vp, cnp->cn_nameptr, cnp->cn_cred, NULL, 0)); } static int |