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/lib/libzfs/common/libzfs_status.c
          +++ new/usr/src/lib/libzfs/common/libzfs_status.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.
       24 + * Copyright (c) 2012 by Delphix. All rights reserved.
  23   25   */
  24   26  
  25   27  /*
  26   28   * This file contains the functions which analyze the status of a pool.  This
  27   29   * include both the status of an active pool, as well as the status exported
  28   30   * pools.  Returns one of the ZPOOL_STATUS_* defines describing the status of
  29   31   * the pool.  This status is independent (to a certain degree) from the state of
  30   32   * the pool.  A pool's state describes only whether or not it is capable of
  31   33   * providing the necessary fault tolerance for data.  The status describes the
  32   34   * overall status of devices.  A pool that is online can still have a device
↓ open down ↓ 174 lines elided ↑ open up ↑
 207  209                  return (ZPOOL_STATUS_HOSTID_MISMATCH);
 208  210  
 209  211          /*
 210  212           * Newer on-disk version.
 211  213           */
 212  214          if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
 213  215              vs->vs_aux == VDEV_AUX_VERSION_NEWER)
 214  216                  return (ZPOOL_STATUS_VERSION_NEWER);
 215  217  
 216  218          /*
      219 +         * Unsupported feature(s).
      220 +         */
      221 +        if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
      222 +            vs->vs_aux == VDEV_AUX_UNSUP_FEAT) {
      223 +                nvlist_t *nvinfo;
      224 +
      225 +                verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO,
      226 +                    &nvinfo) == 0);
      227 +                if (nvlist_exists(nvinfo, ZPOOL_CONFIG_CAN_RDONLY))
      228 +                        return (ZPOOL_STATUS_UNSUP_FEAT_WRITE);
      229 +                return (ZPOOL_STATUS_UNSUP_FEAT_READ);
      230 +        }
      231 +
      232 +        /*
 217  233           * Check that the config is complete.
 218  234           */
 219  235          if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
 220  236              vs->vs_aux == VDEV_AUX_BAD_GUID_SUM)
 221  237                  return (ZPOOL_STATUS_BAD_GUID_SUM);
 222  238  
 223  239          /*
 224  240           * Check whether the pool has suspended due to failed I/O.
 225  241           */
 226  242          if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_SUSPENDED,
↓ open down ↓ 66 lines elided ↑ open up ↑
 293  309  
 294  310          /*
 295  311           * Removed device
 296  312           */
 297  313          if (find_vdev_problem(nvroot, vdev_removed))
 298  314                  return (ZPOOL_STATUS_REMOVED_DEV);
 299  315  
 300  316          /*
 301  317           * Outdated, but usable, version
 302  318           */
 303      -        if (version < SPA_VERSION)
      319 +        if (SPA_VERSION_IS_SUPPORTED(version) && version != SPA_VERSION)
 304  320                  return (ZPOOL_STATUS_VERSION_OLDER);
 305  321  
 306  322          return (ZPOOL_STATUS_OK);
 307  323  }
 308  324  
 309  325  zpool_status_t
 310  326  zpool_get_status(zpool_handle_t *zhp, char **msgid)
 311  327  {
 312  328          zpool_status_t ret = check_status(zhp->zpool_config, B_FALSE);
 313  329  
↓ open down ↓ 85 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX