]> git.proxmox.com Git - mirror_zfs.git/commit
Improve block sizes checks during cloning
authorAlexander Motin <mav@FreeBSD.org>
Tue, 9 Jan 2024 17:46:43 +0000 (12:46 -0500)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2024 17:46:43 +0000 (09:46 -0800)
commit255741fc9755186975d3c2b60ee2be4027800778
treee3ce052e2628f69f48249550161dc8f96f13434e
parent7ecaa0758005a56fa579c87a84a2a25ccd61033e
Improve block sizes checks during cloning

- Fail if source block is smaller than destination.  We can only
grow blocks, not shrink them.
 - Fail if we do not have full znode range lock.  In that case grow
is not even called.  We should improve zfs_rangelock_cb() somehow
to know when cloning needs to grow the block size unlike write.
 - Fail of we tried to resize, but failed.  There are many reasons
for it to fail that we can not predict at this level, so be ready
for them.  Unlike write, that may proceed after growth failure,
block cloning can't and must return error.

This fixes assertion inside dmu_brt_clone() when it sees different
number of blocks held in destination than it got block pointers.
Builds without ZFS_DEBUG returned EXDEV, so are not affected much.

Reviewed-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15724
Closes #15735
module/zfs/zfs_vnops.c