Skip to content

Commit 763ca47

Browse files
authored
Fix block cloning between unencrypted and encrypted datasets
Block cloning from an encrypted dataset into an unencrypted dataset and vice versa is not possible. The current code did allow cloning unencrypted files into an encrypted dataset causing a panic when these were accessed. Block cloning between encrypted and encrypted is currently supported on the same filesystem only. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Kay Pedersen <[email protected]> Reviewed-by: Rob N <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes #15464 Closes #15465
1 parent cba99a0 commit 763ca47

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

module/zfs/zfs_vnops.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,15 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
10881088

10891089
ASSERT(!outzfsvfs->z_replay);
10901090

1091+
/*
1092+
* Block cloning from an unencrypted dataset into an encrypted
1093+
* dataset and vice versa is not supported.
1094+
*/
1095+
if (inos->os_encrypted != outos->os_encrypted) {
1096+
zfs_exit_two(inzfsvfs, outzfsvfs, FTAG);
1097+
return (SET_ERROR(EXDEV));
1098+
}
1099+
10911100
error = zfs_verify_zp(inzp);
10921101
if (error == 0)
10931102
error = zfs_verify_zp(outzp);

0 commit comments

Comments
 (0)