diff options
-rw-r--r-- | module/zfs/zfs_vnops.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 64412a69d..311613ae5 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -3207,13 +3207,18 @@ zfs_rename(struct inode *sdip, char *snm, struct inode *tdip, char *tnm, ZFS_VERIFY_ZP(sdzp); zilog = zsb->z_log; + tdzp = ITOZ(tdip); + ZFS_VERIFY_ZP(tdzp); + + /* + * We check i_sb because snapshots and the ctldir must have different + * super blocks. + */ if (tdip->i_sb != sdip->i_sb || zfsctl_is_node(tdip)) { ZFS_EXIT(zsb); return (SET_ERROR(EXDEV)); } - tdzp = ITOZ(tdip); - ZFS_VERIFY_ZP(tdzp); if (zsb->z_utf8 && u8_validate(tnm, strlen(tnm), NULL, U8_VALIDATE_ENTIRE, &error) < 0) { ZFS_EXIT(zsb); @@ -3751,14 +3756,18 @@ zfs_link(struct inode *tdip, struct inode *sip, char *name, cred_t *cr) return (SET_ERROR(EPERM)); } + szp = ITOZ(sip); + ZFS_VERIFY_ZP(szp); + + /* + * We check i_sb because snapshots and the ctldir must have different + * super blocks. + */ if (sip->i_sb != tdip->i_sb || zfsctl_is_node(sip)) { ZFS_EXIT(zsb); return (SET_ERROR(EXDEV)); } - szp = ITOZ(sip); - ZFS_VERIFY_ZP(szp); - /* Prevent links to .zfs/shares files */ if ((error = sa_lookup(szp->z_sa_hdl, SA_ZPL_PARENT(zsb), |