diff options
author | Rob N <robn@despairlabs.com> | 2023-11-28 17:53:04 +0000 |
---|---|---|
committer | Gordon Tetlow <gordon@FreeBSD.org> | 2023-11-30 21:34:08 +0000 |
commit | 1548705269435e980c5984ba87a554d4b329d176 (patch) | |
tree | 33d2542f2bfba2f6ba54733fdfa8fc7fbf227352 | |
parent | 36f4f90efb027847d6e4b7a940afbee2ad7b3b7e (diff) | |
download | src-1548705269435e980c5984ba87a554d4b329d176.tar.gz src-1548705269435e980c5984ba87a554d4b329d176.zip |
zfs: cherry-pick commit from master
#15566 688514e47 dmu_buf_will_clone: fix race in transition back to NOFILL
Obtained from: OpenZFS
Approved by: so
Security: FreeBSD-EN-23:16.openzfs
(cherry picked from commit 688514e4704bdee4551d25960febd322ac26f297)
(cherry picked from commit 99385ec7c2962c2b5e54161aca6ec57546229cb2)
-rw-r--r-- | sys/contrib/openzfs/module/zfs/dbuf.c | 10 |
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 |