6646545 Condvars in tx_cpu aren't being initialized/destroyed
authorek110237
Thu, 03 Jan 2008 14:55:36 -0800
changeset 5765 86c482ef4a34
parent 5764 8fc95e22d1d1
child 5766 5bbd09315100
6646545 Condvars in tx_cpu aren't being initialized/destroyed 6646559 tx_holds list in dmu_tx not properly destroyed 6646646 dump_ioctl() is using zc_name instead of zc_value in the 'fromsnap' case
usr/src/lib/libzfs/common/libzfs_sendrecv.c
usr/src/uts/common/fs/zfs/dmu_tx.c
usr/src/uts/common/fs/zfs/txg.c
--- a/usr/src/lib/libzfs/common/libzfs_sendrecv.c	Thu Jan 03 14:03:27 2008 -0800
+++ b/usr/src/lib/libzfs/common/libzfs_sendrecv.c	Thu Jan 03 14:55:36 2008 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -426,7 +426,7 @@
 
 	(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
 	if (fromsnap)
-		(void) strlcpy(zc.zc_value, fromsnap, sizeof (zc.zc_name));
+		(void) strlcpy(zc.zc_value, fromsnap, sizeof (zc.zc_value));
 	zc.zc_cookie = outfd;
 	zc.zc_obj = fromorigin;
 
--- a/usr/src/uts/common/fs/zfs/dmu_tx.c	Thu Jan 03 14:03:27 2008 -0800
+++ b/usr/src/uts/common/fs/zfs/dmu_tx.c	Thu Jan 03 14:55:36 2008 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -988,6 +988,7 @@
 
 	if (tx->tx_anyobj == FALSE)
 		txg_rele_to_sync(&tx->tx_txgh);
+	list_destroy(&tx->tx_holds);
 #ifdef ZFS_DEBUG
 	dprintf("towrite=%llu written=%llu tofree=%llu freed=%llu\n",
 	    tx->tx_space_towrite, refcount_count(&tx->tx_space_written),
@@ -1015,6 +1016,7 @@
 		if (dn != NULL)
 			dnode_rele(dn, tx);
 	}
+	list_destroy(&tx->tx_holds);
 #ifdef ZFS_DEBUG
 	refcount_destroy_many(&tx->tx_space_written,
 	    refcount_count(&tx->tx_space_written));
--- a/usr/src/uts/common/fs/zfs/txg.c	Thu Jan 03 14:03:27 2008 -0800
+++ b/usr/src/uts/common/fs/zfs/txg.c	Thu Jan 03 14:55:36 2008 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -53,8 +53,15 @@
 
 	tx->tx_cpu = kmem_zalloc(max_ncpus * sizeof (tx_cpu_t), KM_SLEEP);
 
-	for (c = 0; c < max_ncpus; c++)
+	for (c = 0; c < max_ncpus; c++) {
+		int i;
+
 		mutex_init(&tx->tx_cpu[c].tc_lock, NULL, MUTEX_DEFAULT, NULL);
+		for (i = 0; i < TXG_SIZE; i++) {
+			cv_init(&tx->tx_cpu[c].tc_cv[i], NULL, CV_DEFAULT,
+			    NULL);
+		}
+	}
 
 	rw_init(&tx->tx_suspend, NULL, RW_DEFAULT, NULL);
 	mutex_init(&tx->tx_sync_lock, NULL, MUTEX_DEFAULT, NULL);
@@ -76,8 +83,13 @@
 	rw_destroy(&tx->tx_suspend);
 	mutex_destroy(&tx->tx_sync_lock);
 
-	for (c = 0; c < max_ncpus; c++)
+	for (c = 0; c < max_ncpus; c++) {
+		int i;
+
 		mutex_destroy(&tx->tx_cpu[c].tc_lock);
+		for (i = 0; i < TXG_SIZE; i++)
+			cv_destroy(&tx->tx_cpu[c].tc_cv[i]);
+	}
 
 	kmem_free(tx->tx_cpu, max_ncpus * sizeof (tx_cpu_t));
 
@@ -307,8 +319,7 @@
 		rw_exit(&tx->tx_suspend);
 
 		dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n",
-			txg, tx->tx_quiesce_txg_waiting,
-			tx->tx_sync_txg_waiting);
+		    txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
 		mutex_exit(&tx->tx_sync_lock);
 		spa_sync(dp->dp_spa, txg);
 		mutex_enter(&tx->tx_sync_lock);