Illumos #2619 and #2747
[zfs.git] / module / zfs / zfs_ioctl.c
index d8e8234..98b1dd7 100644 (file)
@@ -18,6 +18,7 @@
  *
  * CDDL HEADER END
  */
+
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Portions Copyright 2011 Martin Matuska
@@ -1107,6 +1108,8 @@ get_zfs_sb(const char *dsname, zfs_sb_t **zsbp)
 /*
  * Find a zfs_sb_t for a mounted filesystem, or create our own, in which
  * case its z_sb 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 inode ops from running.
  */
 static int
 zfs_sb_hold(const char *name, void *tag, zfs_sb_t **zsbp, boolean_t writer)
@@ -1170,7 +1173,7 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
 
                (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;
                }
@@ -1297,6 +1300,15 @@ zfs_ioc_pool_configs(zfs_cmd_t *zc)
        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)
 {
@@ -1398,7 +1410,8 @@ zfs_ioc_pool_upgrade(zfs_cmd_t *zc)
        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);
        }
@@ -5187,6 +5200,7 @@ zfs_detach(void)
        list_destroy(&zfsdev_state_list);
 }
 
+uint_t zfs_fsyncer_key;
 extern uint_t rrw_tsd_key;
 
 #ifdef DEBUG
@@ -5209,6 +5223,7 @@ _init(void)
        if ((error = zfs_attach()) != 0)
                goto out2;
 
+       tsd_create(&zfs_fsyncer_key, NULL);
        tsd_create(&rrw_tsd_key, NULL);
 
        printk(KERN_NOTICE "ZFS: Loaded module v%s-%s%s, "
@@ -5238,6 +5253,7 @@ _fini(void)
        zfs_fini();
        spa_fini();
 
+       tsd_destroy(&zfs_fsyncer_key);
        tsd_destroy(&rrw_tsd_key);
 
        printk(KERN_NOTICE "ZFS: Unloaded module v%s-%s%s\n",