diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 3876b1014..7eda653a8 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -27,6 +27,7 @@ */ #include +#include #include #include #include @@ -5506,6 +5507,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.