Print this page
3956 ::vdev -r should work with pipelines
3957 ztest should update the cachefile before killing itself
3958 multiple scans can lead to partial resilvering
3959 ddt entries are not always resilvered
3960 dsl_scan can skip over dedup-ed blocks if physical birth != logical birth
3961 freed gang blocks are not resilvered and can cause pool to suspend
3962 ztest should print out zfs debug buffer before exiting
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/vdev_label.c
          +++ new/usr/src/uts/common/fs/zfs/vdev_label.c
↓ open down ↓ 208 lines elided ↑ open up ↑
 209  209  
 210  210  /*
 211  211   * Generate the nvlist representing this vdev's config.
 212  212   */
 213  213  nvlist_t *
 214  214  vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats,
 215  215      vdev_config_flag_t flags)
 216  216  {
 217  217          nvlist_t *nv = NULL;
 218  218  
 219      -        VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);
      219 +        nv = fnvlist_alloc();
 220  220  
 221      -        VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_TYPE,
 222      -            vd->vdev_ops->vdev_op_type) == 0);
      221 +        fnvlist_add_string(nv, ZPOOL_CONFIG_TYPE, vd->vdev_ops->vdev_op_type);
 223  222          if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)))
 224      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ID, vd->vdev_id)
 225      -                    == 0);
 226      -        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_GUID, vd->vdev_guid) == 0);
      223 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_ID, vd->vdev_id);
      224 +        fnvlist_add_uint64(nv, ZPOOL_CONFIG_GUID, vd->vdev_guid);
 227  225  
 228  226          if (vd->vdev_path != NULL)
 229      -                VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_PATH,
 230      -                    vd->vdev_path) == 0);
      227 +                fnvlist_add_string(nv, ZPOOL_CONFIG_PATH, vd->vdev_path);
 231  228  
 232  229          if (vd->vdev_devid != NULL)
 233      -                VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_DEVID,
 234      -                    vd->vdev_devid) == 0);
      230 +                fnvlist_add_string(nv, ZPOOL_CONFIG_DEVID, vd->vdev_devid);
 235  231  
 236  232          if (vd->vdev_physpath != NULL)
 237      -                VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_PHYS_PATH,
 238      -                    vd->vdev_physpath) == 0);
      233 +                fnvlist_add_string(nv, ZPOOL_CONFIG_PHYS_PATH,
      234 +                    vd->vdev_physpath);
 239  235  
 240  236          if (vd->vdev_fru != NULL)
 241      -                VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_FRU,
 242      -                    vd->vdev_fru) == 0);
      237 +                fnvlist_add_string(nv, ZPOOL_CONFIG_FRU, vd->vdev_fru);
 243  238  
 244  239          if (vd->vdev_nparity != 0) {
 245  240                  ASSERT(strcmp(vd->vdev_ops->vdev_op_type,
 246  241                      VDEV_TYPE_RAIDZ) == 0);
 247  242  
 248  243                  /*
 249  244                   * Make sure someone hasn't managed to sneak a fancy new vdev
 250  245                   * into a crufty old storage pool.
 251  246                   */
 252  247                  ASSERT(vd->vdev_nparity == 1 ||
 253  248                      (vd->vdev_nparity <= 2 &&
 254  249                      spa_version(spa) >= SPA_VERSION_RAIDZ2) ||
 255  250                      (vd->vdev_nparity <= 3 &&
 256  251                      spa_version(spa) >= SPA_VERSION_RAIDZ3));
 257  252  
 258  253                  /*
 259  254                   * Note that we'll add the nparity tag even on storage pools
 260  255                   * that only support a single parity device -- older software
 261  256                   * will just ignore it.
 262  257                   */
 263      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_NPARITY,
 264      -                    vd->vdev_nparity) == 0);
      258 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_NPARITY, vd->vdev_nparity);
 265  259          }
 266  260  
 267  261          if (vd->vdev_wholedisk != -1ULL)
 268      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
 269      -                    vd->vdev_wholedisk) == 0);
      262 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
      263 +                    vd->vdev_wholedisk);
 270  264  
 271  265          if (vd->vdev_not_present)
 272      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, 1) == 0);
      266 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, 1);
 273  267  
 274  268          if (vd->vdev_isspare)
 275      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1) == 0);
      269 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1);
 276  270  
 277  271          if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
 278  272              vd == vd->vdev_top) {
 279      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
 280      -                    vd->vdev_ms_array) == 0);
 281      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
 282      -                    vd->vdev_ms_shift) == 0);
 283      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT,
 284      -                    vd->vdev_ashift) == 0);
 285      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
 286      -                    vd->vdev_asize) == 0);
 287      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG,
 288      -                    vd->vdev_islog) == 0);
      273 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
      274 +                    vd->vdev_ms_array);
      275 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
      276 +                    vd->vdev_ms_shift);
      277 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT, vd->vdev_ashift);
      278 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
      279 +                    vd->vdev_asize);
      280 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG, vd->vdev_islog);
 289  281                  if (vd->vdev_removing)
 290      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
 291      -                            vd->vdev_removing) == 0);
      282 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
      283 +                            vd->vdev_removing);
 292  284          }
 293  285  
 294  286          if (vd->vdev_dtl_smo.smo_object != 0)
 295      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
 296      -                    vd->vdev_dtl_smo.smo_object) == 0);
      287 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
      288 +                    vd->vdev_dtl_smo.smo_object);
 297  289  
 298  290          if (vd->vdev_crtxg)
 299      -                VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG,
 300      -                    vd->vdev_crtxg) == 0);
      291 +                fnvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG, vd->vdev_crtxg);
 301  292  
 302  293          if (getstats) {
 303  294                  vdev_stat_t vs;
 304  295                  pool_scan_stat_t ps;
 305  296  
 306  297                  vdev_get_stats(vd, &vs);
 307      -                VERIFY(nvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
 308      -                    (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t)) == 0);
      298 +                fnvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
      299 +                    (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t));
 309  300  
 310  301                  /* provide either current or previous scan information */
 311  302                  if (spa_scan_get_stats(spa, &ps) == 0) {
 312      -                        VERIFY(nvlist_add_uint64_array(nv,
      303 +                        fnvlist_add_uint64_array(nv,
 313  304                              ZPOOL_CONFIG_SCAN_STATS, (uint64_t *)&ps,
 314      -                            sizeof (pool_scan_stat_t) / sizeof (uint64_t))
 315      -                            == 0);
      305 +                            sizeof (pool_scan_stat_t) / sizeof (uint64_t));
 316  306                  }
 317  307          }
 318  308  
 319  309          if (!vd->vdev_ops->vdev_op_leaf) {
 320  310                  nvlist_t **child;
 321  311                  int c, idx;
 322  312  
 323  313                  ASSERT(!vd->vdev_ishole);
 324  314  
 325  315                  child = kmem_alloc(vd->vdev_children * sizeof (nvlist_t *),
↓ open down ↓ 9 lines elided ↑ open up ↑
 335  325                           */
 336  326                          if ((flags & VDEV_CONFIG_REMOVING) &&
 337  327                              !cvd->vdev_removing)
 338  328                                  continue;
 339  329  
 340  330                          child[idx++] = vdev_config_generate(spa, cvd,
 341  331                              getstats, flags);
 342  332                  }
 343  333  
 344  334                  if (idx) {
 345      -                        VERIFY(nvlist_add_nvlist_array(nv,
 346      -                            ZPOOL_CONFIG_CHILDREN, child, idx) == 0);
      335 +                        fnvlist_add_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
      336 +                            child, idx);
 347  337                  }
 348  338  
 349  339                  for (c = 0; c < idx; c++)
 350  340                          nvlist_free(child[c]);
 351  341  
 352  342                  kmem_free(child, vd->vdev_children * sizeof (nvlist_t *));
 353  343  
 354  344          } else {
 355  345                  const char *aux = NULL;
 356  346  
 357  347                  if (vd->vdev_offline && !vd->vdev_tmpoffline)
 358      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_OFFLINE,
 359      -                            B_TRUE) == 0);
 360      -                if (vd->vdev_resilvering)
 361      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_RESILVERING,
 362      -                            B_TRUE) == 0);
      348 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_OFFLINE, B_TRUE);
      349 +                if (vd->vdev_resilver_txg != 0)
      350 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_RESILVER_TXG,
      351 +                            vd->vdev_resilver_txg);
 363  352                  if (vd->vdev_faulted)
 364      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_FAULTED,
 365      -                            B_TRUE) == 0);
      353 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_FAULTED, B_TRUE);
 366  354                  if (vd->vdev_degraded)
 367      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_DEGRADED,
 368      -                            B_TRUE) == 0);
      355 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_DEGRADED, B_TRUE);
 369  356                  if (vd->vdev_removed)
 370      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVED,
 371      -                            B_TRUE) == 0);
      357 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVED, B_TRUE);
 372  358                  if (vd->vdev_unspare)
 373      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_UNSPARE,
 374      -                            B_TRUE) == 0);
      359 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_UNSPARE, B_TRUE);
 375  360                  if (vd->vdev_ishole)
 376      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_HOLE,
 377      -                            B_TRUE) == 0);
      361 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_HOLE, B_TRUE);
 378  362  
 379  363                  switch (vd->vdev_stat.vs_aux) {
 380  364                  case VDEV_AUX_ERR_EXCEEDED:
 381  365                          aux = "err_exceeded";
 382  366                          break;
 383  367  
 384  368                  case VDEV_AUX_EXTERNAL:
 385  369                          aux = "external";
 386  370                          break;
 387  371                  }
 388  372  
 389  373                  if (aux != NULL)
 390      -                        VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_AUX_STATE,
 391      -                            aux) == 0);
      374 +                        fnvlist_add_string(nv, ZPOOL_CONFIG_AUX_STATE, aux);
 392  375  
 393  376                  if (vd->vdev_splitting && vd->vdev_orig_guid != 0LL) {
 394      -                        VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ORIG_GUID,
 395      -                            vd->vdev_orig_guid) == 0);
      377 +                        fnvlist_add_uint64(nv, ZPOOL_CONFIG_ORIG_GUID,
      378 +                            vd->vdev_orig_guid);
 396  379                  }
 397  380          }
 398  381  
 399  382          return (nv);
 400  383  }
 401  384  
 402  385  /*
 403  386   * Generate a view of the top-level vdevs.  If we currently have holes
 404  387   * in the namespace, then generate an array which contains a list of holey
 405  388   * vdevs.  Additionally, add the number of top-level children that currently
↓ open down ↓ 882 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX