Print this page
2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Dan McDonald <danmcd@nexenta.com>

@@ -16,10 +16,11 @@
  * fields enclosed by brackets "[]" replaced with your own identifying
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
+
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Portions Copyright 2011 Martin Matuska
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.

@@ -1132,10 +1133,12 @@
 }
 
 /*
  * Find a zfsvfs_t for a mounted filesystem, or create our own, in which
  * case its z_vfs will be NULL, and it will be opened as the owner.
+ * If 'writer' is set, the z_teardown_lock will be held for RW_WRITER,
+ * which prevents all vnode ops from running.
  */
 static int
 zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zfvp, boolean_t writer)
 {
         int error = 0;

@@ -1195,11 +1198,11 @@
                 nvlist_t *nvl = NULL;
                 uint64_t version = SPA_VERSION;
 
                 (void) nvlist_lookup_uint64(props,
                     zpool_prop_to_name(ZPOOL_PROP_VERSION), &version);
-                if (version < SPA_VERSION_INITIAL || version > SPA_VERSION) {
+                if (!SPA_VERSION_IS_SUPPORTED(version)) {
                         error = EINVAL;
                         goto pool_props_bad;
                 }
                 (void) nvlist_lookup_nvlist(props, ZPOOL_ROOTFS_PROPS, &nvl);
                 if (nvl) {

@@ -1319,10 +1322,19 @@
         nvlist_free(configs);
 
         return (error);
 }
 
+/*
+ * inputs:
+ * zc_name              name of the pool
+ *
+ * outputs:
+ * zc_cookie            real errno
+ * zc_nvlist_dst        config nvlist
+ * zc_nvlist_dst_size   size of config nvlist
+ */
 static int
 zfs_ioc_pool_stats(zfs_cmd_t *zc)
 {
         nvlist_t *config;
         int error;

@@ -1420,11 +1432,12 @@
         int error;
 
         if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0)
                 return (error);
 
-        if (zc->zc_cookie < spa_version(spa) || zc->zc_cookie > SPA_VERSION) {
+        if (zc->zc_cookie < spa_version(spa) ||
+            !SPA_VERSION_IS_SUPPORTED(zc->zc_cookie)) {
                 spa_close(spa, FTAG);
                 return (EINVAL);
         }
 
         spa_upgrade(spa, zc->zc_cookie);