From ba3c7692cd73291b16abdf5ce7e51c058f73fca7 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 24 May 2024 22:11:18 -0400 Subject: [PATCH] Destroy ARC buffer in case of fill error In case of error dmu_buf_fill_done() returns the buffer back into DB_UNCACHED state. Since during transition from DB_UNCACHED into DB_FILL state dbuf_noread() allocates an ARC buffer, we must free it here, otherwise it will be leaked. Reviewed-by: Brian Behlendorf Reviewed-by: Jorgen Lundman Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. Closes #15665 Closes #15802 Closes #16216 --- module/zfs/dbuf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index d56117cde0..f81ae96f2e 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -2834,6 +2834,7 @@ dmu_buf_fill_done(dmu_buf_t *dbuf, dmu_tx_t *tx, boolean_t failed) failed = B_FALSE; } else if (failed) { VERIFY(!dbuf_undirty(db, tx)); + arc_buf_destroy(db->db_buf, db); db->db_buf = NULL; dbuf_clear_data(db); DTRACE_SET_STATE(db, "fill failed");