diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index e723d7640..ec25855cd 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -28,6 +28,7 @@ */ #include +#include #include #include #include @@ -5536,6 +5537,13 @@ spa_remap_blkptr(spa_t *spa, blkptr_t *bp, spa_remap_cb_t callback, void *arg) if (BP_GET_NDVAS(bp) < 1) return (B_FALSE); + /* + * Cloned blocks can not be remapped since BRT depends on specific + * vdev id and offset in the DVA[0] for its reference counting. + */ + if (!BP_IS_METADATA(bp) && brt_maybe_exists(spa, bp)) + return (B_FALSE); + /* * Note: we only remap dva[0]. If we remapped other dvas, we * would no longer know what their phys birth txg is.