Skip to content

Commit 383fc4a

Browse files
ahrensbehlendorf
authored andcommitted
Illumos #3955
3955 ztest failure: assertion refcount_count(&tx->tx_space_written) + delta <= tx->tx_space_towrite Reviewed by: Adam Leventhal <ahl@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Richard Lowe <richlowe@richlowe.net> References: https://www.illumos.org/issues/3955 illumos/illumos-gate@be9000c Ported-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #1775
1 parent 9554185 commit 383fc4a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmd/ztest/ztest.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3715,6 +3715,9 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
37153715
else
37163716
dmu_tx_hold_write(tx, bigobj, bigoff, bigsize);
37173717

3718+
/* This accounts for setting the checksum/compression. */
3719+
dmu_tx_hold_bonus(tx, bigobj);
3720+
37183721
txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
37193722
if (txg == 0) {
37203723
umem_free(packbuf, packsize);

module/zfs/dmu_tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,12 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, uint64_t off, uint64_t len)
465465
blkid = off >> dn->dn_datablkshift;
466466
nblks = (len + dn->dn_datablksz - 1) >> dn->dn_datablkshift;
467467

468-
if (blkid >= dn->dn_maxblkid) {
468+
if (blkid > dn->dn_maxblkid) {
469469
rw_exit(&dn->dn_struct_rwlock);
470470
return;
471471
}
472472
if (blkid + nblks > dn->dn_maxblkid)
473-
nblks = dn->dn_maxblkid - blkid;
473+
nblks = dn->dn_maxblkid - blkid + 1;
474474

475475
}
476476
l0span = nblks; /* save for later use to calc level > 1 overhead */

0 commit comments

Comments
 (0)