Print this page
NEX-4649 zpool create <name> special <disk> command hangs
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/common/zfs/zfs_comutil.c
          +++ new/usr/src/common/zfs/zfs_comutil.c
↓ open down ↓ 35 lines elided ↑ open up ↑
  36   36  #endif
  37   37  
  38   38  #include <sys/types.h>
  39   39  #include <sys/fs/zfs.h>
  40   40  #include <sys/int_limits.h>
  41   41  #include <sys/nvpair.h>
  42   42  #include "zfs_comutil.h"
  43   43  
  44   44  /*
  45   45   * Are there allocatable vdevs?
       46 + * Any pool must have at least one normal (metaslab) class vdev, which means:
       47 + * at least one that is simultaneously non-slog and non-special
  46   48   */
  47   49  boolean_t
  48   50  zfs_allocatable_devs(nvlist_t *nv)
  49   51  {
  50      -        uint64_t is_log;
       52 +        uint64_t is_log, is_special;
  51   53          uint_t c;
  52   54          nvlist_t **child;
  53   55          uint_t children;
  54   56  
  55   57          if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
  56   58              &child, &children) != 0) {
  57   59                  return (B_FALSE);
  58   60          }
  59   61          for (c = 0; c < children; c++) {
  60      -                is_log = 0;
       62 +                is_log = is_special = 0;
  61   63                  (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
  62   64                      &is_log);
  63      -                if (!is_log)
       65 +                (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_SPECIAL,
       66 +                    &is_special);
       67 +                if (!is_log && !is_special)
  64   68                          return (B_TRUE);
  65   69          }
  66   70          return (B_FALSE);
  67   71  }
  68   72  
  69   73  void
  70   74  zpool_get_rewind_policy(nvlist_t *nvl, zpool_rewind_policy_t *zrpp)
  71   75  {
  72   76          nvlist_t *policy;
  73   77          nvpair_t *elem;
↓ open down ↓ 134 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX