Fix raw receive with different indirect block size.
commit56ed389a575a63bf21fa293b21a2d27dd67b7bad
authorAlexander Motin <mav@FreeBSD.org>
Fri, 14 Jul 2023 23:16:40 +0000 (14 19:16 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 20 Jul 2023 15:58:29 +0000 (20 08:58 -0700)
treec9d73da165d5a56e2ac28ae15a3578890605253b
parente613e4bbe397ed4eea08502cc8694bc990ab5ebe
Fix raw receive with different indirect block size.

Unlike regular receive, raw receive require destination to have the
same block structure as the source.  In case of dnode reclaim this
triggers two special cases, requiring special handling:
 - If dn_nlevels == 1, we can change the ibs, but dnode_set_blksz()
should not dirty the data buffer if block size does not change, or
durign receive dbuf_dirty_lightweight() will trigger assertion.
 - If dn_nlevels > 1, we just can't change the ibs, dnode_set_blksz()
would fail and receive_object would trigger assertion, so we should
destroy and recreate the dnode from scratch.

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15039

(cherry picked from commit c4e8742149e31a77dc074f3baacfefed3ccb800e)
module/zfs/dmu_recv.c
module/zfs/dnode.c