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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_ioctl.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_ioctl.c
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
       21 +
  21   22  /*
  22   23   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   24   * Portions Copyright 2011 Martin Matuska
  24   25   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  25   26   * Copyright (c) 2012 by Delphix. All rights reserved.
  26   27   * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  27   28   */
  28   29  
  29   30  #include <sys/types.h>
  30   31  #include <sys/param.h>
↓ open down ↓ 1096 lines elided ↑ open up ↑
1127 1128                  error = ESRCH;
1128 1129          }
1129 1130          mutex_exit(&os->os_user_ptr_lock);
1130 1131          dmu_objset_rele(os, FTAG);
1131 1132          return (error);
1132 1133  }
1133 1134  
1134 1135  /*
1135 1136   * Find a zfsvfs_t for a mounted filesystem, or create our own, in which
1136 1137   * case its z_vfs will be NULL, and it will be opened as the owner.
     1138 + * If 'writer' is set, the z_teardown_lock will be held for RW_WRITER,
     1139 + * which prevents all vnode ops from running.
1137 1140   */
1138 1141  static int
1139 1142  zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zfvp, boolean_t writer)
1140 1143  {
1141 1144          int error = 0;
1142 1145  
1143 1146          if (getzfsvfs(name, zfvp) != 0)
1144 1147                  error = zfsvfs_create(name, zfvp);
1145 1148          if (error == 0) {
1146 1149                  rrw_enter(&(*zfvp)->z_teardown_lock, (writer) ? RW_WRITER :
↓ open down ↓ 43 lines elided ↑ open up ↑
1190 1193                  nvlist_free(config);
1191 1194                  return (error);
1192 1195          }
1193 1196  
1194 1197          if (props) {
1195 1198                  nvlist_t *nvl = NULL;
1196 1199                  uint64_t version = SPA_VERSION;
1197 1200  
1198 1201                  (void) nvlist_lookup_uint64(props,
1199 1202                      zpool_prop_to_name(ZPOOL_PROP_VERSION), &version);
1200      -                if (version < SPA_VERSION_INITIAL || version > SPA_VERSION) {
     1203 +                if (!SPA_VERSION_IS_SUPPORTED(version)) {
1201 1204                          error = EINVAL;
1202 1205                          goto pool_props_bad;
1203 1206                  }
1204 1207                  (void) nvlist_lookup_nvlist(props, ZPOOL_ROOTFS_PROPS, &nvl);
1205 1208                  if (nvl) {
1206 1209                          error = nvlist_dup(nvl, &rootprops, KM_SLEEP);
1207 1210                          if (error != 0) {
1208 1211                                  nvlist_free(config);
1209 1212                                  nvlist_free(props);
1210 1213                                  return (error);
↓ open down ↓ 103 lines elided ↑ open up ↑
1314 1317          if ((configs = spa_all_configs(&zc->zc_cookie)) == NULL)
1315 1318                  return (EEXIST);
1316 1319  
1317 1320          error = put_nvlist(zc, configs);
1318 1321  
1319 1322          nvlist_free(configs);
1320 1323  
1321 1324          return (error);
1322 1325  }
1323 1326  
     1327 +/*
     1328 + * inputs:
     1329 + * zc_name              name of the pool
     1330 + *
     1331 + * outputs:
     1332 + * zc_cookie            real errno
     1333 + * zc_nvlist_dst        config nvlist
     1334 + * zc_nvlist_dst_size   size of config nvlist
     1335 + */
1324 1336  static int
1325 1337  zfs_ioc_pool_stats(zfs_cmd_t *zc)
1326 1338  {
1327 1339          nvlist_t *config;
1328 1340          int error;
1329 1341          int ret = 0;
1330 1342  
1331 1343          error = spa_get_stats(zc->zc_name, &config, zc->zc_value,
1332 1344              sizeof (zc->zc_value));
1333 1345  
↓ open down ↓ 81 lines elided ↑ open up ↑
1415 1427  
1416 1428  static int
1417 1429  zfs_ioc_pool_upgrade(zfs_cmd_t *zc)
1418 1430  {
1419 1431          spa_t *spa;
1420 1432          int error;
1421 1433  
1422 1434          if ((error = spa_open(zc->zc_name, &spa, FTAG)) != 0)
1423 1435                  return (error);
1424 1436  
1425      -        if (zc->zc_cookie < spa_version(spa) || zc->zc_cookie > SPA_VERSION) {
     1437 +        if (zc->zc_cookie < spa_version(spa) ||
     1438 +            !SPA_VERSION_IS_SUPPORTED(zc->zc_cookie)) {
1426 1439                  spa_close(spa, FTAG);
1427 1440                  return (EINVAL);
1428 1441          }
1429 1442  
1430 1443          spa_upgrade(spa, zc->zc_cookie);
1431 1444          spa_close(spa, FTAG);
1432 1445  
1433 1446          return (error);
1434 1447  }
1435 1448  
↓ open down ↓ 3886 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX