diff options
author | davide <davide@FreeBSD.org> | 2013-09-20 23:22:00 +0000 |
---|---|---|
committer | davide <davide@FreeBSD.org> | 2013-09-20 23:22:00 +0000 |
commit | bce147746d1a5ea29f54f93b5f2f6add24307d01 (patch) | |
tree | 4142d6821db9e4f6620dd925a46fb1505d4950dd /sys/cddl/contrib/opensolaris/uts | |
parent | defa3b8b8514a27c55c8c03cf37f7c8177bb3efe (diff) | |
download | FreeBSD-src-bce147746d1a5ea29f54f93b5f2f6add24307d01.zip FreeBSD-src-bce147746d1a5ea29f54f93b5f2f6add24307d01.tar.gz |
Fixup cross-device rename checks in ZFS. Add a check for the case
where 'fdvp' is a directory, 'tvp' is an already existing directory
and they have different mount points.
Reported by: avg, pjd
Reviewed by: pjd
Approved by: re (rodrigc)
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 11 |
1 files changed, 7 insertions, 4 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 2716c25..d9dacbf 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,12 +6250,15 @@ zfs_freebsd_rename(ap) ASSERT(ap->a_fcnp->cn_flags & (SAVENAME|SAVESTART)); ASSERT(ap->a_tcnp->cn_flags & (SAVENAME|SAVESTART)); - if (fdvp->v_mount == tdvp->v_mount) + /* + * Check for cross-device rename. + */ + if ((fdvp->v_mount != tdvp->v_mount) || + (tvp && (fdvp->v_mount != tvp->v_mount))) + error = EXDEV; + else 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); else |