diff usr/src/uts/common/fs/zfs/spa.c @ 10298:a0d52501437c

6860996 %temporary clones are not automatically destroyed on error 6863088 zfs panic in dnode_hold_impl from readdir()
author Matthew Ahrens <Matthew.Ahrens@Sun.COM>
date Wed, 12 Aug 2009 22:11:31 -0700
parents 4a6965f6bef8
children 108f0058f837
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/spa.c	Wed Aug 12 21:16:19 2009 -0700
+++ b/usr/src/uts/common/fs/zfs/spa.c	Wed Aug 12 22:11:31 2009 -0700
@@ -371,12 +371,14 @@
 					break;
 				}
 
-				if (error = dmu_objset_open(strval, DMU_OST_ZFS,
-				    DS_MODE_USER | DS_MODE_READONLY, &os))
+				if (error = dmu_objset_hold(strval, FTAG, &os))
 					break;
 
-				/* We don't support gzip bootable datasets */
-				if ((error = dsl_prop_get_integer(strval,
+				/* Must be ZPL and not gzip compressed. */
+
+				if (dmu_objset_type(os) != DMU_OST_ZFS) {
+					error = ENOTSUP;
+				} else if ((error = dsl_prop_get_integer(strval,
 				    zfs_prop_to_name(ZFS_PROP_COMPRESSION),
 				    &compress, NULL)) == 0 &&
 				    !BOOTFS_COMPRESS_VALID(compress)) {
@@ -384,7 +386,7 @@
 				} else {
 					objnum = dmu_objset_id(os);
 				}
-				dmu_objset_close(os);
+				dmu_objset_rele(os, FTAG);
 			}
 			break;
 
@@ -1598,6 +1600,12 @@
 		 */
 		if (vdev_resilver_needed(rvd, NULL, NULL))
 			spa_async_request(spa, SPA_ASYNC_RESILVER);
+
+		/*
+		 * Delete any inconsistent datasets.
+		 */
+		(void) dmu_objset_find(spa_name(spa),
+		    dsl_destroy_inconsistent, NULL, DS_FIND_CHILDREN);
 	}
 
 	error = 0;