summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Ahrens <mahrens@delphix.com>2013-08-07 10:32:46 -0800
committerChristopher Siden <chris.siden@delphix.com>2013-08-07 11:32:47 -0700
commitbe9000cc677e0a8d04e5be45c61d7370fc8c7b54 (patch)
tree08457e9be325bef0c1ed3ea1e0583bfff0ccca99
parent2c1e2b44148432fb7a509dd216a99299b6740250 (diff)
downloadillumos-joyent-be9000cc677e0a8d04e5be45c61d7370fc8c7b54.tar.gz
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>
-rw-r--r--usr/src/cmd/ztest/ztest.c3
-rw-r--r--usr/src/uts/common/fs/zfs/dmu_tx.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c
index 22717410ea..7b5fc46397 100644
--- a/usr/src/cmd/ztest/ztest.c
+++ b/usr/src/cmd/ztest/ztest.c
@@ -3605,6 +3605,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/usr/src/uts/common/fs/zfs/dmu_tx.c b/usr/src/uts/common/fs/zfs/dmu_tx.c
index 929b0c4d97..8d23aa374c 100644
--- a/usr/src/uts/common/fs/zfs/dmu_tx.c
+++ b/usr/src/uts/common/fs/zfs/dmu_tx.c
@@ -448,12 +448,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 */