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/cmd/ztest/ztest.c
          +++ new/usr/src/cmd/ztest/ztest.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  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   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright (c) 2012 by Delphix. All rights reserved.
       23 + * Copyright (c) 2013 by Delphix. All rights reserved.
  24   24   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  25   25   * Copyright (c) 2013 Steven Hartland. All rights reserved.
  26   26   */
  27   27  
  28   28  /*
  29   29   * The objective of this program is to provide a DMU/ZAP/SPA stress test
  30   30   * that runs entirely in userland, is easy to use, and easy to extend.
  31   31   *
  32   32   * The overall design of the ztest program is as follows:
  33   33   *
↓ open down ↓ 726 lines elided ↑ open up ↑
 760  760                  umem_free(cmd, MAXPATHLEN);
 761  761                  umem_free(realaltdir, MAXPATHLEN);
 762  762          }
 763  763  }
 764  764  
 765  765  static void
 766  766  ztest_kill(ztest_shared_t *zs)
 767  767  {
 768  768          zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(ztest_spa));
 769  769          zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa));
      770 +
      771 +        /*
      772 +         * Before we kill off ztest, make sure that the config is updated.
      773 +         * See comment above spa_config_sync().
      774 +         */
      775 +        mutex_enter(&spa_namespace_lock);
      776 +        spa_config_sync(ztest_spa, B_FALSE, B_FALSE);
      777 +        mutex_exit(&spa_namespace_lock);
      778 +
      779 +        zfs_dbgmsg_print(FTAG);
 770  780          (void) kill(getpid(), SIGKILL);
 771  781  }
 772  782  
 773  783  static uint64_t
 774  784  ztest_random(uint64_t range)
 775  785  {
 776  786          uint64_t r;
 777  787  
 778  788          ASSERT3S(ztest_fd_rand, >=, 0);
 779  789  
↓ open down ↓ 1944 lines elided ↑ open up ↑
2724 2734          ztest_shared_t *zs = ztest_shared;
2725 2735          spa_t *spa = ztest_spa;
2726 2736          spa_aux_vdev_t *sav = &spa->spa_spares;
2727 2737          vdev_t *rvd = spa->spa_root_vdev;
2728 2738          vdev_t *oldvd, *newvd, *pvd;
2729 2739          nvlist_t *root;
2730 2740          uint64_t leaves;
2731 2741          uint64_t leaf, top;
2732 2742          uint64_t ashift = ztest_get_ashift();
2733 2743          uint64_t oldguid, pguid;
2734      -        size_t oldsize, newsize;
     2744 +        uint64_t oldsize, newsize;
2735 2745          char oldpath[MAXPATHLEN], newpath[MAXPATHLEN];
2736 2746          int replacing;
2737 2747          int oldvd_has_siblings = B_FALSE;
2738 2748          int newvd_is_spare = B_FALSE;
2739 2749          int oldvd_is_log;
2740 2750          int error, expected_error;
2741 2751  
2742 2752          VERIFY(mutex_lock(&ztest_vdev_lock) == 0);
2743 2753          leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz;
2744 2754  
↓ open down ↓ 138 lines elided ↑ open up ↑
2883 2893          /*
2884 2894           * If someone grew the LUN, the replacement may be too small.
2885 2895           */
2886 2896          if (error == EOVERFLOW || error == EBUSY)
2887 2897                  expected_error = error;
2888 2898  
2889 2899          /* XXX workaround 6690467 */
2890 2900          if (error != expected_error && expected_error != EBUSY) {
2891 2901                  fatal(0, "attach (%s %llu, %s %llu, %d) "
2892 2902                      "returned %d, expected %d",
2893      -                    oldpath, (longlong_t)oldsize, newpath,
2894      -                    (longlong_t)newsize, replacing, error, expected_error);
     2903 +                    oldpath, oldsize, newpath,
     2904 +                    newsize, replacing, error, expected_error);
2895 2905          }
2896 2906  
2897 2907          VERIFY(mutex_unlock(&ztest_vdev_lock) == 0);
2898 2908  }
2899 2909  
2900 2910  /*
2901 2911   * Callback function which expands the physical size of the vdev.
2902 2912   */
2903 2913  vdev_t *
2904 2914  grow_vdev(vdev_t *vd, void *arg)
↓ open down ↓ 1889 lines elided ↑ open up ↑
4794 4804                  if (vd0 != NULL && vd0->vdev_top->vdev_islog)
4795 4805                          islog = B_TRUE;
4796 4806  
4797 4807                  /*
4798 4808                   * If the top-level vdev needs to be resilvered
4799 4809                   * then we only allow faults on the device that is
4800 4810                   * resilvering.
4801 4811                   */
4802 4812                  if (vd0 != NULL && maxfaults != 1 &&
4803 4813                      (!vdev_resilver_needed(vd0->vdev_top, NULL, NULL) ||
4804      -                    vd0->vdev_resilvering)) {
     4814 +                    vd0->vdev_resilver_txg != 0)) {
4805 4815                          /*
4806 4816                           * Make vd0 explicitly claim to be unreadable,
4807 4817                           * or unwriteable, or reach behind its back
4808 4818                           * and close the underlying fd.  We can do this if
4809 4819                           * maxfaults == 0 because we'll fail and reexecute,
4810 4820                           * and we can do it if maxfaults >= 2 because we'll
4811 4821                           * have enough redundancy.  If maxfaults == 1, the
4812 4822                           * combination of this with injection of random data
4813 4823                           * corruption below exceeds the pool's fault tolerance.
4814 4824                           */
↓ open down ↓ 829 lines elided ↑ open up ↑
5644 5654          for (int t = ztest_opts.zo_threads - 1; t >= 0; t--) {
5645 5655                  VERIFY(thr_join(tid[t], NULL, NULL) == 0);
5646 5656                  if (t < ztest_opts.zo_datasets)
5647 5657                          ztest_dataset_close(t);
5648 5658          }
5649 5659  
5650 5660          txg_wait_synced(spa_get_dsl(spa), 0);
5651 5661  
5652 5662          zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(spa));
5653 5663          zs->zs_space = metaslab_class_get_space(spa_normal_class(spa));
     5664 +        zfs_dbgmsg_print(FTAG);
5654 5665  
5655 5666          umem_free(tid, ztest_opts.zo_threads * sizeof (thread_t));
5656 5667  
5657 5668          /* Kill the resume thread */
5658 5669          ztest_exiting = B_TRUE;
5659 5670          VERIFY(thr_join(resume_tid, NULL, NULL) == 0);
5660 5671          ztest_resume(spa);
5661 5672  
5662 5673          /*
5663 5674           * Right before closing the pool, kick off a bunch of async I/O;
↓ open down ↓ 598 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX