Fix DMU bonus hold leak on I/O error

brt_vdev_load() will leak the DMU bonus hold on an error from
dmu_read() because the corresponding dmu_buf_rele() is not called in the
error path.

Reported-by: Grok 4.5 Build Beta
Reviewed-by: Igor Kozhukhov <[email protected]>
Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #18865
This commit is contained in:
Richard Yao authored and GitHub committed 2026-07-31 13:02:41 -07:00
1 parent 596c7a0ecb
commit 412b17a29a
1 file changed
+3 -1
+3 -1
View File
@@ -582,8 +582,10 @@ brt_vdev_load(spa_t *spa, brt_vdev_t *brtvd)
error = dmu_read(spa->spa_meta_objset, brtvd->bv_mos_brtvdev, 0,
MIN(brtvd->bv_size, bvphys->bvp_size) * sizeof (uint16_t),
brtvd->bv_entcount, DMU_READ_NO_PREFETCH | DMU_UNCACHEDIO);
if (error != 0)
if (error != 0) {
dmu_buf_rele(db, FTAG);
return (error);
}
ASSERT(bvphys->bvp_mos_entries != 0);
VERIFY0(dnode_hold(spa->spa_meta_objset, bvphys->bvp_mos_entries, brtvd,