From 53685510819ffdfa9964013703e96c7374fb6651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sat, 20 Aug 2022 23:49:51 +0300 Subject: [PATCH] mdbx: minor clarify `iov_page()` failure case. --- src/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index a8d57100..e86ad782 100644 --- a/src/core.c +++ b/src/core.c @@ -5611,8 +5611,11 @@ static int mdbx_txn_spill(MDBX_txn *const txn, MDBX_cursor *const m0, txn->tw.dirtyroom += spilled; mdbx_tassert(txn, mdbx_dirtylist_check(txn)); - if (ctx.iov_items) + if (ctx.iov_items) { + /* iov_page() frees dirty-pages and reset iov_items in case of failure. */ + mdbx_tassert(txn, rc == MDBX_SUCCESS); rc = mdbx_iov_write(txn, &ctx); + } if (unlikely(rc != MDBX_SUCCESS)) goto bailout; @@ -9979,8 +9982,11 @@ static int mdbx_txn_write(MDBX_txn *txn, struct mdbx_iov_ctx *ctx) { break; } - if (ctx->iov_items) + if (ctx->iov_items) { + /* iov_page() frees dirty-pages and reset iov_items in case of failure. */ + mdbx_tassert(txn, rc == MDBX_SUCCESS); rc = mdbx_iov_write(txn, ctx); + } while (r <= dl->length) dl->items[++w] = dl->items[r++];