Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Aug 2013 22:21:00 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254077 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201308072221.r77ML0Nl027426@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed Aug  7 22:21:00 2013
New Revision: 254077
URL: http://svnweb.freebsd.org/changeset/base/254077

Log:
  MFV r254071:
  
  Fix a regression introduced by fix for Illumos bug #3834.  Quote from
  Matthew Ahrens on the Illumos issue:
  
  ztest fails this assertion because ztest_dmu_read_write() does
          dmu_tx_hold_free(tx, bigobj, bigoff, bigsize);
  and then
      dmu_object_set_checksum(os, bigobj,
          (enum zio_checksum)ztest_random_dsl_prop(ZFS_PROP_CHECKSUM), tx);
  
  If the region to free is past the end of the file, the DMU assumes that there
  will be nothing to do for this object.  However, ztest does set_checksum(),
  which must modify the dnode.  The fix is for ztest to also call
  
      dmu_tx_hold_bonus(tx, bigobj);
  
  so we can account for the dirty data associated with setting the checksum
  
  Illumos ZFS issues:
    3955 ztest failure: assertion refcount_count(&tx->tx_space_written)
           + delta <= tx->tx_space_towrite

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Wed Aug  7 22:01:43 2013	(r254076)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Wed Aug  7 22:21:00 2013	(r254077)
@@ -3607,6 +3607,9 @@ ztest_dmu_read_write(ztest_ds_t *zd, uin
 	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);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c	Wed Aug  7 22:01:43 2013	(r254076)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c	Wed Aug  7 22:21:00 2013	(r254077)
@@ -448,12 +448,12 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, ui
 		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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308072221.r77ML0Nl027426>