diff usr/src/uts/common/fs/zfs/dsl_dataset.c @ 5569:d3caac36d311

6634062 dsl_dataset_open_obj misuses RW_LOCK_HELD 6634881 dsl_prop_register can release a lock it doesn't own
author ck153898
date Fri, 30 Nov 2007 13:22:52 -0800
parents 85721e07d1fa
children 81f1af42bafc
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/dsl_dataset.c	Fri Nov 30 13:11:57 2007 -0800
+++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c	Fri Nov 30 13:22:52 2007 -0800
@@ -375,8 +375,14 @@
 		}
 
 		if (!dsl_dataset_is_snapshot(ds)) {
+			/*
+			 * In sync context, we're called with either no lock
+			 * or with the write lock.  If we're not syncing,
+			 * we're always called with the read lock held.
+			 */
 			boolean_t need_lock =
-			    !RW_LOCK_HELD(&dp->dp_config_rwlock);
+			    !RW_WRITE_HELD(&dp->dp_config_rwlock) &&
+			    dsl_pool_sync_context(dp);
 
 			if (need_lock)
 				rw_enter(&dp->dp_config_rwlock, RW_READER);