Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>


2235         (void) rw_unlock(&zd->zd_zilog_lock);
2236 }
2237 
2238 /*
2239  * Verify that we can't destroy an active pool, create an existing pool,
2240  * or create a pool with a bad vdev spec.
2241  */
2242 /* ARGSUSED */
2243 void
2244 ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
2245 {
2246         ztest_shared_opts_t *zo = &ztest_opts;
2247         spa_t *spa;
2248         nvlist_t *nvroot;
2249 
2250         /*
2251          * Attempt to create using a bad file.
2252          */
2253         nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
2254         VERIFY3U(ENOENT, ==,
2255             spa_create("ztest_bad_file", nvroot, NULL, NULL, NULL));
2256         nvlist_free(nvroot);
2257 
2258         /*
2259          * Attempt to create using a bad mirror.
2260          */
2261         nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 2, 1);
2262         VERIFY3U(ENOENT, ==,
2263             spa_create("ztest_bad_mirror", nvroot, NULL, NULL, NULL));
2264         nvlist_free(nvroot);
2265 
2266         /*
2267          * Attempt to create an existing pool.  It shouldn't matter
2268          * what's in the nvroot; we should fail with EEXIST.
2269          */
2270         (void) rw_rdlock(&ztest_name_lock);
2271         nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
2272         VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL));
2273         nvlist_free(nvroot);
2274         VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG));
2275         VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool));
2276         spa_close(spa, FTAG);
2277 
2278         (void) rw_unlock(&ztest_name_lock);
2279 }
2280 
2281 static vdev_t *
2282 vdev_lookup_by_path(vdev_t *vd, const char *path)
2283 {
2284         vdev_t *mvd;
2285 
2286         if (vd->vdev_path != NULL && strcmp(path, vd->vdev_path) == 0)
2287                 return (vd);
2288 
2289         for (int c = 0; c < vd->vdev_children; c++)
2290                 if ((mvd = vdev_lookup_by_path(vd->vdev_child[c], path)) !=
2291                     NULL)
2292                         return (mvd);


3039                 ASSERT3S(doi.doi_physical_blocks_512, >=, 0);
3040         }
3041         dmu_objset_rele(os, FTAG);
3042 
3043         /*
3044          * Destroy the dataset.
3045          */
3046         VERIFY3U(0, ==, dmu_objset_destroy(name, B_FALSE));
3047         return (0);
3048 }
3049 
3050 static boolean_t
3051 ztest_snapshot_create(char *osname, uint64_t id)
3052 {
3053         char snapname[MAXNAMELEN];
3054         int error;
3055 
3056         (void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
3057             (u_longlong_t)id);
3058 
3059         error = dmu_objset_snapshot(osname, strchr(snapname, '@') + 1,
3060             NULL, NULL, B_FALSE, B_FALSE, -1);
3061         if (error == ENOSPC) {
3062                 ztest_record_enospc(FTAG);
3063                 return (B_FALSE);
3064         }
3065         if (error != 0 && error != EEXIST)
3066                 fatal(0, "ztest_snapshot_create(%s) = %d", snapname, error);
3067         return (B_TRUE);
3068 }
3069 
3070 static boolean_t
3071 ztest_snapshot_destroy(char *osname, uint64_t id)
3072 {
3073         char snapname[MAXNAMELEN];
3074         int error;
3075 
3076         (void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
3077             (u_longlong_t)id);
3078 
3079         error = dmu_objset_destroy(snapname, B_FALSE);
3080         if (error != 0 && error != ENOENT)


3240         objset_t *clone;
3241         dsl_dataset_t *ds;
3242         char snap1name[MAXNAMELEN];
3243         char clone1name[MAXNAMELEN];
3244         char snap2name[MAXNAMELEN];
3245         char clone2name[MAXNAMELEN];
3246         char snap3name[MAXNAMELEN];
3247         char *osname = zd->zd_name;
3248         int error;
3249 
3250         (void) rw_rdlock(&ztest_name_lock);
3251 
3252         ztest_dsl_dataset_cleanup(osname, id);
3253 
3254         (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
3255         (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
3256         (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
3257         (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
3258         (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
3259 
3260         error = dmu_objset_snapshot(osname, strchr(snap1name, '@')+1,
3261             NULL, NULL, B_FALSE, B_FALSE, -1);
3262         if (error && error != EEXIST) {
3263                 if (error == ENOSPC) {
3264                         ztest_record_enospc(FTAG);
3265                         goto out;
3266                 }
3267                 fatal(0, "dmu_take_snapshot(%s) = %d", snap1name, error);
3268         }
3269 
3270         error = dmu_objset_hold(snap1name, FTAG, &clone);
3271         if (error)
3272                 fatal(0, "dmu_open_snapshot(%s) = %d", snap1name, error);
3273 
3274         error = dmu_objset_clone(clone1name, dmu_objset_ds(clone), 0);
3275         dmu_objset_rele(clone, FTAG);
3276         if (error) {
3277                 if (error == ENOSPC) {
3278                         ztest_record_enospc(FTAG);
3279                         goto out;
3280                 }
3281                 fatal(0, "dmu_objset_create(%s) = %d", clone1name, error);
3282         }
3283 
3284         error = dmu_objset_snapshot(clone1name, strchr(snap2name, '@')+1,
3285             NULL, NULL, B_FALSE, B_FALSE, -1);
3286         if (error && error != EEXIST) {
3287                 if (error == ENOSPC) {
3288                         ztest_record_enospc(FTAG);
3289                         goto out;
3290                 }
3291                 fatal(0, "dmu_open_snapshot(%s) = %d", snap2name, error);
3292         }
3293 
3294         error = dmu_objset_snapshot(clone1name, strchr(snap3name, '@')+1,
3295             NULL, NULL, B_FALSE, B_FALSE, -1);
3296         if (error && error != EEXIST) {
3297                 if (error == ENOSPC) {
3298                         ztest_record_enospc(FTAG);
3299                         goto out;
3300                 }
3301                 fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
3302         }
3303 
3304         error = dmu_objset_hold(snap3name, FTAG, &clone);
3305         if (error)
3306                 fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
3307 
3308         error = dmu_objset_clone(clone2name, dmu_objset_ds(clone), 0);
3309         dmu_objset_rele(clone, FTAG);
3310         if (error) {
3311                 if (error == ENOSPC) {
3312                         ztest_record_enospc(FTAG);
3313                         goto out;
3314                 }
3315                 fatal(0, "dmu_objset_create(%s) = %d", clone2name, error);


4463         (void) rw_rdlock(&ztest_name_lock);
4464 
4465         dmu_objset_name(os, osname);
4466 
4467         (void) snprintf(snapname, 100, "sh1_%llu", id);
4468         (void) snprintf(fullname, 100, "%s@%s", osname, snapname);
4469         (void) snprintf(clonename, 100, "%s/ch1_%llu", osname, id);
4470         (void) snprintf(tag, 100, "%tag_%llu", id);
4471 
4472         /*
4473          * Clean up from any previous run.
4474          */
4475         (void) dmu_objset_destroy(clonename, B_FALSE);
4476         (void) dsl_dataset_user_release(osname, snapname, tag, B_FALSE);
4477         (void) dmu_objset_destroy(fullname, B_FALSE);
4478 
4479         /*
4480          * Create snapshot, clone it, mark snap for deferred destroy,
4481          * destroy clone, verify snap was also destroyed.
4482          */
4483         error = dmu_objset_snapshot(osname, snapname, NULL, NULL, FALSE,
4484             FALSE, -1);
4485         if (error) {
4486                 if (error == ENOSPC) {
4487                         ztest_record_enospc("dmu_objset_snapshot");
4488                         goto out;
4489                 }
4490                 fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
4491         }
4492 
4493         error = dmu_objset_hold(fullname, FTAG, &origin);
4494         if (error)
4495                 fatal(0, "dmu_objset_hold(%s) = %d", fullname, error);
4496 
4497         error = dmu_objset_clone(clonename, dmu_objset_ds(origin), 0);
4498         dmu_objset_rele(origin, FTAG);
4499         if (error) {
4500                 if (error == ENOSPC) {
4501                         ztest_record_enospc("dmu_objset_clone");
4502                         goto out;
4503                 }
4504                 fatal(0, "dmu_objset_clone(%s) = %d", clonename, error);


4506 
4507         error = dmu_objset_destroy(fullname, B_TRUE);
4508         if (error) {
4509                 fatal(0, "dmu_objset_destroy(%s, B_TRUE) = %d",
4510                     fullname, error);
4511         }
4512 
4513         error = dmu_objset_destroy(clonename, B_FALSE);
4514         if (error)
4515                 fatal(0, "dmu_objset_destroy(%s) = %d", clonename, error);
4516 
4517         error = dmu_objset_hold(fullname, FTAG, &origin);
4518         if (error != ENOENT)
4519                 fatal(0, "dmu_objset_hold(%s) = %d", fullname, error);
4520 
4521         /*
4522          * Create snapshot, add temporary hold, verify that we can't
4523          * destroy a held snapshot, mark for deferred destroy,
4524          * release hold, verify snapshot was destroyed.
4525          */
4526         error = dmu_objset_snapshot(osname, snapname, NULL, NULL, FALSE,
4527             FALSE, -1);
4528         if (error) {
4529                 if (error == ENOSPC) {
4530                         ztest_record_enospc("dmu_objset_snapshot");
4531                         goto out;
4532                 }
4533                 fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
4534         }
4535 
4536         error = dsl_dataset_user_hold(osname, snapname, tag, B_FALSE,
4537             B_TRUE, -1);
4538         if (error)
4539                 fatal(0, "dsl_dataset_user_hold(%s)", fullname, tag);
4540 
4541         error = dmu_objset_destroy(fullname, B_FALSE);
4542         if (error != EBUSY) {
4543                 fatal(0, "dmu_objset_destroy(%s, B_FALSE) = %d",
4544                     fullname, error);
4545         }
4546 
4547         error = dmu_objset_destroy(fullname, B_TRUE);


5595         VERIFY(rwlock_init(&ztest_name_lock, USYNC_THREAD, NULL) == 0);
5596 
5597         kernel_init(FREAD | FWRITE);
5598 
5599         /*
5600          * Create the storage pool.
5601          */
5602         (void) spa_destroy(ztest_opts.zo_pool);
5603         ztest_shared->zs_vdev_next_leaf = 0;
5604         zs->zs_splits = 0;
5605         zs->zs_mirrors = ztest_opts.zo_mirrors;
5606         nvroot = make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0,
5607             0, ztest_opts.zo_raidz, zs->zs_mirrors, 1);
5608         props = make_random_props();
5609         for (int i = 0; i < SPA_FEATURES; i++) {
5610                 char buf[1024];
5611                 (void) snprintf(buf, sizeof (buf), "feature@%s",
5612                     spa_feature_table[i].fi_uname);
5613                 VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0));
5614         }
5615         VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props,
5616             NULL, NULL));
5617         nvlist_free(nvroot);
5618 
5619         VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
5620         zs->zs_metaslab_sz =
5621             1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift;
5622 
5623         spa_close(spa, FTAG);
5624 
5625         kernel_fini();
5626 
5627         ztest_run_zdb(ztest_opts.zo_pool);
5628 
5629         ztest_freeze();
5630 
5631         ztest_run_zdb(ztest_opts.zo_pool);
5632 
5633         (void) rwlock_destroy(&ztest_name_lock);
5634         (void) _mutex_destroy(&ztest_vdev_lock);
5635 }
5636 




2235         (void) rw_unlock(&zd->zd_zilog_lock);
2236 }
2237 
2238 /*
2239  * Verify that we can't destroy an active pool, create an existing pool,
2240  * or create a pool with a bad vdev spec.
2241  */
2242 /* ARGSUSED */
2243 void
2244 ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
2245 {
2246         ztest_shared_opts_t *zo = &ztest_opts;
2247         spa_t *spa;
2248         nvlist_t *nvroot;
2249 
2250         /*
2251          * Attempt to create using a bad file.
2252          */
2253         nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
2254         VERIFY3U(ENOENT, ==,
2255             spa_create("ztest_bad_file", nvroot, NULL, NULL));
2256         nvlist_free(nvroot);
2257 
2258         /*
2259          * Attempt to create using a bad mirror.
2260          */
2261         nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 2, 1);
2262         VERIFY3U(ENOENT, ==,
2263             spa_create("ztest_bad_mirror", nvroot, NULL, NULL));
2264         nvlist_free(nvroot);
2265 
2266         /*
2267          * Attempt to create an existing pool.  It shouldn't matter
2268          * what's in the nvroot; we should fail with EEXIST.
2269          */
2270         (void) rw_rdlock(&ztest_name_lock);
2271         nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
2272         VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL));
2273         nvlist_free(nvroot);
2274         VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG));
2275         VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool));
2276         spa_close(spa, FTAG);
2277 
2278         (void) rw_unlock(&ztest_name_lock);
2279 }
2280 
2281 static vdev_t *
2282 vdev_lookup_by_path(vdev_t *vd, const char *path)
2283 {
2284         vdev_t *mvd;
2285 
2286         if (vd->vdev_path != NULL && strcmp(path, vd->vdev_path) == 0)
2287                 return (vd);
2288 
2289         for (int c = 0; c < vd->vdev_children; c++)
2290                 if ((mvd = vdev_lookup_by_path(vd->vdev_child[c], path)) !=
2291                     NULL)
2292                         return (mvd);


3039                 ASSERT3S(doi.doi_physical_blocks_512, >=, 0);
3040         }
3041         dmu_objset_rele(os, FTAG);
3042 
3043         /*
3044          * Destroy the dataset.
3045          */
3046         VERIFY3U(0, ==, dmu_objset_destroy(name, B_FALSE));
3047         return (0);
3048 }
3049 
3050 static boolean_t
3051 ztest_snapshot_create(char *osname, uint64_t id)
3052 {
3053         char snapname[MAXNAMELEN];
3054         int error;
3055 
3056         (void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
3057             (u_longlong_t)id);
3058 
3059         error = dmu_objset_snapshot_one(osname, strchr(snapname, '@') + 1);

3060         if (error == ENOSPC) {
3061                 ztest_record_enospc(FTAG);
3062                 return (B_FALSE);
3063         }
3064         if (error != 0 && error != EEXIST)
3065                 fatal(0, "ztest_snapshot_create(%s) = %d", snapname, error);
3066         return (B_TRUE);
3067 }
3068 
3069 static boolean_t
3070 ztest_snapshot_destroy(char *osname, uint64_t id)
3071 {
3072         char snapname[MAXNAMELEN];
3073         int error;
3074 
3075         (void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
3076             (u_longlong_t)id);
3077 
3078         error = dmu_objset_destroy(snapname, B_FALSE);
3079         if (error != 0 && error != ENOENT)


3239         objset_t *clone;
3240         dsl_dataset_t *ds;
3241         char snap1name[MAXNAMELEN];
3242         char clone1name[MAXNAMELEN];
3243         char snap2name[MAXNAMELEN];
3244         char clone2name[MAXNAMELEN];
3245         char snap3name[MAXNAMELEN];
3246         char *osname = zd->zd_name;
3247         int error;
3248 
3249         (void) rw_rdlock(&ztest_name_lock);
3250 
3251         ztest_dsl_dataset_cleanup(osname, id);
3252 
3253         (void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
3254         (void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
3255         (void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
3256         (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
3257         (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
3258 
3259         error = dmu_objset_snapshot_one(osname, strchr(snap1name, '@') + 1);

3260         if (error && error != EEXIST) {
3261                 if (error == ENOSPC) {
3262                         ztest_record_enospc(FTAG);
3263                         goto out;
3264                 }
3265                 fatal(0, "dmu_take_snapshot(%s) = %d", snap1name, error);
3266         }
3267 
3268         error = dmu_objset_hold(snap1name, FTAG, &clone);
3269         if (error)
3270                 fatal(0, "dmu_open_snapshot(%s) = %d", snap1name, error);
3271 
3272         error = dmu_objset_clone(clone1name, dmu_objset_ds(clone), 0);
3273         dmu_objset_rele(clone, FTAG);
3274         if (error) {
3275                 if (error == ENOSPC) {
3276                         ztest_record_enospc(FTAG);
3277                         goto out;
3278                 }
3279                 fatal(0, "dmu_objset_create(%s) = %d", clone1name, error);
3280         }
3281 
3282         error = dmu_objset_snapshot_one(clone1name, strchr(snap2name, '@') + 1);

3283         if (error && error != EEXIST) {
3284                 if (error == ENOSPC) {
3285                         ztest_record_enospc(FTAG);
3286                         goto out;
3287                 }
3288                 fatal(0, "dmu_open_snapshot(%s) = %d", snap2name, error);
3289         }
3290 
3291         error = dmu_objset_snapshot_one(clone1name, strchr(snap3name, '@') + 1);

3292         if (error && error != EEXIST) {
3293                 if (error == ENOSPC) {
3294                         ztest_record_enospc(FTAG);
3295                         goto out;
3296                 }
3297                 fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
3298         }
3299 
3300         error = dmu_objset_hold(snap3name, FTAG, &clone);
3301         if (error)
3302                 fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
3303 
3304         error = dmu_objset_clone(clone2name, dmu_objset_ds(clone), 0);
3305         dmu_objset_rele(clone, FTAG);
3306         if (error) {
3307                 if (error == ENOSPC) {
3308                         ztest_record_enospc(FTAG);
3309                         goto out;
3310                 }
3311                 fatal(0, "dmu_objset_create(%s) = %d", clone2name, error);


4459         (void) rw_rdlock(&ztest_name_lock);
4460 
4461         dmu_objset_name(os, osname);
4462 
4463         (void) snprintf(snapname, 100, "sh1_%llu", id);
4464         (void) snprintf(fullname, 100, "%s@%s", osname, snapname);
4465         (void) snprintf(clonename, 100, "%s/ch1_%llu", osname, id);
4466         (void) snprintf(tag, 100, "%tag_%llu", id);
4467 
4468         /*
4469          * Clean up from any previous run.
4470          */
4471         (void) dmu_objset_destroy(clonename, B_FALSE);
4472         (void) dsl_dataset_user_release(osname, snapname, tag, B_FALSE);
4473         (void) dmu_objset_destroy(fullname, B_FALSE);
4474 
4475         /*
4476          * Create snapshot, clone it, mark snap for deferred destroy,
4477          * destroy clone, verify snap was also destroyed.
4478          */
4479         error = dmu_objset_snapshot_one(osname, snapname);

4480         if (error) {
4481                 if (error == ENOSPC) {
4482                         ztest_record_enospc("dmu_objset_snapshot");
4483                         goto out;
4484                 }
4485                 fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
4486         }
4487 
4488         error = dmu_objset_hold(fullname, FTAG, &origin);
4489         if (error)
4490                 fatal(0, "dmu_objset_hold(%s) = %d", fullname, error);
4491 
4492         error = dmu_objset_clone(clonename, dmu_objset_ds(origin), 0);
4493         dmu_objset_rele(origin, FTAG);
4494         if (error) {
4495                 if (error == ENOSPC) {
4496                         ztest_record_enospc("dmu_objset_clone");
4497                         goto out;
4498                 }
4499                 fatal(0, "dmu_objset_clone(%s) = %d", clonename, error);


4501 
4502         error = dmu_objset_destroy(fullname, B_TRUE);
4503         if (error) {
4504                 fatal(0, "dmu_objset_destroy(%s, B_TRUE) = %d",
4505                     fullname, error);
4506         }
4507 
4508         error = dmu_objset_destroy(clonename, B_FALSE);
4509         if (error)
4510                 fatal(0, "dmu_objset_destroy(%s) = %d", clonename, error);
4511 
4512         error = dmu_objset_hold(fullname, FTAG, &origin);
4513         if (error != ENOENT)
4514                 fatal(0, "dmu_objset_hold(%s) = %d", fullname, error);
4515 
4516         /*
4517          * Create snapshot, add temporary hold, verify that we can't
4518          * destroy a held snapshot, mark for deferred destroy,
4519          * release hold, verify snapshot was destroyed.
4520          */
4521         error = dmu_objset_snapshot_one(osname, snapname);

4522         if (error) {
4523                 if (error == ENOSPC) {
4524                         ztest_record_enospc("dmu_objset_snapshot");
4525                         goto out;
4526                 }
4527                 fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
4528         }
4529 
4530         error = dsl_dataset_user_hold(osname, snapname, tag, B_FALSE,
4531             B_TRUE, -1);
4532         if (error)
4533                 fatal(0, "dsl_dataset_user_hold(%s)", fullname, tag);
4534 
4535         error = dmu_objset_destroy(fullname, B_FALSE);
4536         if (error != EBUSY) {
4537                 fatal(0, "dmu_objset_destroy(%s, B_FALSE) = %d",
4538                     fullname, error);
4539         }
4540 
4541         error = dmu_objset_destroy(fullname, B_TRUE);


5589         VERIFY(rwlock_init(&ztest_name_lock, USYNC_THREAD, NULL) == 0);
5590 
5591         kernel_init(FREAD | FWRITE);
5592 
5593         /*
5594          * Create the storage pool.
5595          */
5596         (void) spa_destroy(ztest_opts.zo_pool);
5597         ztest_shared->zs_vdev_next_leaf = 0;
5598         zs->zs_splits = 0;
5599         zs->zs_mirrors = ztest_opts.zo_mirrors;
5600         nvroot = make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0,
5601             0, ztest_opts.zo_raidz, zs->zs_mirrors, 1);
5602         props = make_random_props();
5603         for (int i = 0; i < SPA_FEATURES; i++) {
5604                 char buf[1024];
5605                 (void) snprintf(buf, sizeof (buf), "feature@%s",
5606                     spa_feature_table[i].fi_uname);
5607                 VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0));
5608         }
5609         VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props, NULL));

5610         nvlist_free(nvroot);
5611 
5612         VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
5613         zs->zs_metaslab_sz =
5614             1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift;
5615 
5616         spa_close(spa, FTAG);
5617 
5618         kernel_fini();
5619 
5620         ztest_run_zdb(ztest_opts.zo_pool);
5621 
5622         ztest_freeze();
5623 
5624         ztest_run_zdb(ztest_opts.zo_pool);
5625 
5626         (void) rwlock_destroy(&ztest_name_lock);
5627         (void) _mutex_destroy(&ztest_vdev_lock);
5628 }
5629