aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2024-05-25 02:11:18 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2024-06-18 17:35:52 +0000
commitf566b7eb8d94bdde7ad9ddf9bdc9cf336678c386 (patch)
treeacb310c9332f8573bec3391957f40556996e0c1d
parent10e31f0946d820d53adc58b7d013b969e4a9a8ed (diff)
downloadsrc-f566b7eb8d94bdde7ad9ddf9bdc9cf336678c386.tar.gz
src-f566b7eb8d94bdde7ad9ddf9bdc9cf336678c386.zip
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 <behlendorf1@llnl.gov> Reviewed-by: Jorgen Lundman <lundman@lundman.net> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15665 Closes #15802 Closes #16216 PR: 276341 Approved by: so Security: FreeBSD-EN-24:10.zfs (cherry picked from commit 02c5aa9b092818785ed8db4e2246a828278138e3) (cherry picked from commit 1c27279ed22d2b5226f31836da041bae45a9c77b)
-rw-r--r--sys/contrib/openzfs/module/zfs/dbuf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/contrib/openzfs/module/zfs/dbuf.c b/sys/contrib/openzfs/module/zfs/dbuf.c
index bb921af6d78a..0576da6475b1 100644
--- a/sys/contrib/openzfs/module/zfs/dbuf.c
+++ b/sys/contrib/openzfs/module/zfs/dbuf.c
@@ -2840,6 +2840,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");