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 <mav@FreeBSD.org> Reviewed-by: Kay Pedersen <mail@mkwg.de> Reviewed-by: Rob N <robn@despairlabs.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Martin Matuska <mm@FreeBSD.org> Closes #15464 Closes #15465
This commit is contained in:
parent
cba99a046e
commit
763ca47fa8
|
@ -1088,6 +1088,15 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
|
||||||
|
|
||||||
ASSERT(!outzfsvfs->z_replay);
|
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);
|
error = zfs_verify_zp(inzp);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
error = zfs_verify_zp(outzp);
|
error = zfs_verify_zp(outzp);
|
||||||
|
|
Loading…
Reference in New Issue