Skip to content

Commit

Permalink
Fix block cloning between unencrypted and encrypted datasets
Browse files Browse the repository at this point in the history
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.

Fixes #15464

Signed-off-by:  Martin Matuska <[email protected]>
  • Loading branch information
mmatuska committed Oct 30, 2023
1 parent 043c6ee commit 02d18a2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions module/zfs/zfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 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);
Expand Down

0 comments on commit 02d18a2

Please sign in to comment.