Skip to content

Commit 8c3151d

Browse files
committed
dbuf: Set dr_data when unoverriding after clone
Block cloning normally creates dirty record without dr_data. But if the block is read after cloning, it is moved into DB_CACHED state and receives the data buffer. If after that we call dbuf_unoverride() to convert the dirty record into normal write, we should give it the data buffer from dbuf and release one. Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc.
1 parent 8ad73bf commit 8c3151d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

module/zfs/dbuf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,7 +1919,6 @@ dbuf_unoverride(dbuf_dirty_record_t *dr)
19191919
dmu_buf_impl_t *db = dr->dr_dbuf;
19201920
blkptr_t *bp = &dr->dt.dl.dr_overridden_by;
19211921
uint64_t txg = dr->dr_txg;
1922-
boolean_t release;
19231922

19241923
ASSERT(MUTEX_HELD(&db->db_mtx));
19251924
/*
@@ -1940,7 +1939,8 @@ dbuf_unoverride(dbuf_dirty_record_t *dr)
19401939
if (!BP_IS_HOLE(bp) && !dr->dt.dl.dr_nopwrite)
19411940
zio_free(db->db_objset->os_spa, txg, bp);
19421941

1943-
release = !dr->dt.dl.dr_brtwrite;
1942+
if (dr->dt.dl.dr_brtwrite)
1943+
dr->dt.dl.dr_data = db->db_buf;
19441944
dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN;
19451945
dr->dt.dl.dr_nopwrite = B_FALSE;
19461946
dr->dt.dl.dr_brtwrite = B_FALSE;
@@ -1954,7 +1954,7 @@ dbuf_unoverride(dbuf_dirty_record_t *dr)
19541954
* the buf thawed to save the effort of freezing &
19551955
* immediately re-thawing it.
19561956
*/
1957-
if (release)
1957+
if (dr->dt.dl.dr_data)
19581958
arc_release(dr->dt.dl.dr_data, db);
19591959
}
19601960

0 commit comments

Comments
 (0)