aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob N <robn@despairlabs.com>2023-11-28 17:53:04 +0000
committerMartin Matuska <mm@FreeBSD.org>2023-11-28 21:00:48 +0000
commit99385ec7c2962c2b5e54161aca6ec57546229cb2 (patch)
tree26f3298bd4cb6bd50c86b456a094f4d27364fc07
parent1b910e43b0216b284bddc83dbdb1322f8d76062c (diff)
zfs: cherry-pick commit from master
#15566 688514e47 dmu_buf_will_clone: fix race in transition back to NOFILL Obtained from: OpenZFS (cherry picked from commit 688514e4704bdee4551d25960febd322ac26f297)
-rw-r--r--sys/contrib/openzfs/module/zfs/dbuf.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/contrib/openzfs/module/zfs/dbuf.c b/sys/contrib/openzfs/module/zfs/dbuf.c
index f2831a0e8abf..5a7fe42b602a 100644
--- a/sys/contrib/openzfs/module/zfs/dbuf.c
+++ b/sys/contrib/openzfs/module/zfs/dbuf.c
@@ -2700,15 +2700,23 @@ dmu_buf_will_clone(dmu_buf_t *db_fake, dmu_tx_t *tx)
* writes and clones into this block.
*/
mutex_enter(&db->db_mtx);
+ DBUF_VERIFY(db);
VERIFY(!dbuf_undirty(db, tx));
ASSERT3P(dbuf_find_dirty_eq(db, tx->tx_txg), ==, NULL);
if (db->db_buf != NULL) {
arc_buf_destroy(db->db_buf, db);
db->db_buf = NULL;
+ dbuf_clear_data(db);
}
+
+ db->db_state = DB_NOFILL;
+ DTRACE_SET_STATE(db, "allocating NOFILL buffer for clone");
+
+ DBUF_VERIFY(db);
mutex_exit(&db->db_mtx);
- dmu_buf_will_not_fill(db_fake, tx);
+ dbuf_noread(db);
+ (void) dbuf_dirty(db, tx);
}
void