summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2013-08-07 10:32:46 -0800
committerBrian Behlendorf <[email protected]>2013-11-05 12:16:14 -0800
commit383fc4a9970ede483dc4bd7579f1c62942d1312f (patch)
treebc98a98911c5d218b8911d6424f9f07133bab132
parent9554185d90a9f833c023c1bb8bc35779b8fd1b10 (diff)
Illumos #3955
3955 ztest failure: assertion refcount_count(&tx->tx_space_written) + delta <= tx->tx_space_towrite Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Richard Lowe <[email protected]> References: https://www.illumos.org/issues/3955 illumos/illumos-gate@be9000cc677e0a8d04e5be45c61d7370fc8c7b54 Ported-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #1775
-rw-r--r--cmd/ztest/ztest.c3
-rw-r--r--module/zfs/dmu_tx.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 3b26f8d1e..0a7ca1c16 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -3715,6 +3715,9 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
else
dmu_tx_hold_write(tx, bigobj, bigoff, bigsize);
+ /* This accounts for setting the checksum/compression. */
+ dmu_tx_hold_bonus(tx, bigobj);
+
txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
if (txg == 0) {
umem_free(packbuf, packsize);
diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c
index 7ee214bb0..5e4a5cbbe 100644
--- a/module/zfs/dmu_tx.c
+++ b/module/zfs/dmu_tx.c
@@ -465,12 +465,12 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, uint64_t off, uint64_t len)
blkid = off >> dn->dn_datablkshift;
nblks = (len + dn->dn_datablksz - 1) >> dn->dn_datablkshift;
- if (blkid >= dn->dn_maxblkid) {
+ if (blkid > dn->dn_maxblkid) {
rw_exit(&dn->dn_struct_rwlock);
return;
}
if (blkid + nblks > dn->dn_maxblkid)
- nblks = dn->dn_maxblkid - blkid;
+ nblks = dn->dn_maxblkid - blkid + 1;
}
l0span = nblks; /* save for later use to calc level > 1 overhead */