From 02c5aa9b092818785ed8db4e2246a828278138e3 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 bce41948c40c..56fe2c4dbe30 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -2853,6 +2853,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");