diff options
author | Martin Matuška <[email protected]> | 2023-10-31 21:49:41 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2023-11-06 10:40:50 -0800 |
commit | 459c99ff2339a4a514abcf2255f9b3e5324ef09e (patch) | |
tree | 17be1dfac9f1b0e8c4019e02ada58a68e526a615 | |
parent | 95785196f26e92d82cf4445654ba84e4a9671c57 (diff) |
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
-rw-r--r-- | module/zfs/zfs_vnops.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 40d6c87a7..84e6b10ef 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1094,6 +1094,15 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, ASSERT(!outzfsvfs->z_replay); + /* + * Block cloning from an unencrypted dataset into an encrypted + * dataset and vice versa is not supported. + */ + if (inos->os_encrypted != outos->os_encrypted) { + zfs_exit_two(inzfsvfs, outzfsvfs, FTAG); + return (SET_ERROR(EXDEV)); + } + error = zfs_verify_zp(inzp); if (error == 0) error = zfs_verify_zp(outzp); |