Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ztest/ztest.c
          +++ new/usr/src/cmd/ztest/ztest.c
↓ open down ↓ 964 lines elided ↑ open up ↑
 965  965          int error;
 966  966  
 967  967          error = dsl_prop_set(osname, propname,
 968  968              (inherit ? ZPROP_SRC_NONE : ZPROP_SRC_LOCAL),
 969  969              sizeof (value), 1, &value);
 970  970  
 971  971          if (error == ENOSPC) {
 972  972                  ztest_record_enospc(FTAG);
 973  973                  return (error);
 974  974          }
 975      -        ASSERT3U(error, ==, 0);
      975 +        ASSERT0(error);
 976  976  
 977  977          VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
 978  978              1, &curval, setpoint), ==, 0);
 979  979  
 980  980          if (ztest_opts.zo_verbose >= 6) {
 981  981                  VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0);
 982  982                  (void) printf("%s %s = %s at '%s'\n",
 983  983                      osname, propname, valname, setpoint);
 984  984          }
 985  985  
↓ open down ↓ 11 lines elided ↑ open up ↑
 997  997          VERIFY(nvlist_add_uint64(props, zpool_prop_to_name(prop), value) == 0);
 998  998  
 999  999          error = spa_prop_set(spa, props);
1000 1000  
1001 1001          nvlist_free(props);
1002 1002  
1003 1003          if (error == ENOSPC) {
1004 1004                  ztest_record_enospc(FTAG);
1005 1005                  return (error);
1006 1006          }
1007      -        ASSERT3U(error, ==, 0);
     1007 +        ASSERT0(error);
1008 1008  
1009 1009          return (error);
1010 1010  }
1011 1011  
1012 1012  static void
1013 1013  ztest_rll_init(rll_t *rll)
1014 1014  {
1015 1015          rll->rll_writer = NULL;
1016 1016          rll->rll_readers = 0;
1017 1017          VERIFY(_mutex_init(&rll->rll_lock, USYNC_THREAD, NULL) == 0);
↓ open down ↓ 387 lines elided ↑ open up ↑
1405 1405          if (error) {
1406 1406                  ASSERT3U(error, ==, EEXIST);
1407 1407                  ASSERT(zd->zd_zilog->zl_replay);
1408 1408                  dmu_tx_commit(tx);
1409 1409                  return (error);
1410 1410          }
1411 1411  
1412 1412          ASSERT(lr->lr_foid != 0);
1413 1413  
1414 1414          if (lr->lrz_type != DMU_OT_ZAP_OTHER)
1415      -                VERIFY3U(0, ==, dmu_object_set_blocksize(os, lr->lr_foid,
     1415 +                VERIFY0(dmu_object_set_blocksize(os, lr->lr_foid,
1416 1416                      lr->lrz_blocksize, lr->lrz_ibshift, tx));
1417 1417  
1418      -        VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
     1418 +        VERIFY0(dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1419 1419          bbt = ztest_bt_bonus(db);
1420 1420          dmu_buf_will_dirty(db, tx);
1421 1421          ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_gen, txg, txg);
1422 1422          dmu_buf_rele(db, FTAG);
1423 1423  
1424      -        VERIFY3U(0, ==, zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1,
     1424 +        VERIFY0(zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1,
1425 1425              &lr->lr_foid, tx));
1426 1426  
1427 1427          (void) ztest_log_create(zd, tx, lr);
1428 1428  
1429 1429          dmu_tx_commit(tx);
1430 1430  
1431 1431          return (0);
1432 1432  }
1433 1433  
1434 1434  static int
↓ open down ↓ 4 lines elided ↑ open up ↑
1439 1439          dmu_object_info_t doi;
1440 1440          dmu_tx_t *tx;
1441 1441          uint64_t object, txg;
1442 1442  
1443 1443          if (byteswap)
1444 1444                  byteswap_uint64_array(lr, sizeof (*lr));
1445 1445  
1446 1446          ASSERT(lr->lr_doid == ZTEST_DIROBJ);
1447 1447          ASSERT(name[0] != '\0');
1448 1448  
1449      -        VERIFY3U(0, ==,
     1449 +        VERIFY0(
1450 1450              zap_lookup(os, lr->lr_doid, name, sizeof (object), 1, &object));
1451 1451          ASSERT(object != 0);
1452 1452  
1453 1453          ztest_object_lock(zd, object, RL_WRITER);
1454 1454  
1455      -        VERIFY3U(0, ==, dmu_object_info(os, object, &doi));
     1455 +        VERIFY0(dmu_object_info(os, object, &doi));
1456 1456  
1457 1457          tx = dmu_tx_create(os);
1458 1458  
1459 1459          dmu_tx_hold_zap(tx, lr->lr_doid, B_FALSE, name);
1460 1460          dmu_tx_hold_free(tx, object, 0, DMU_OBJECT_END);
1461 1461  
1462 1462          txg = ztest_tx_assign(tx, TXG_WAIT, FTAG);
1463 1463          if (txg == 0) {
1464 1464                  ztest_object_unlock(zd, object);
1465 1465                  return (ENOSPC);
1466 1466          }
1467 1467  
1468 1468          if (doi.doi_type == DMU_OT_ZAP_OTHER) {
1469      -                VERIFY3U(0, ==, zap_destroy(os, object, tx));
     1469 +                VERIFY0(zap_destroy(os, object, tx));
1470 1470          } else {
1471      -                VERIFY3U(0, ==, dmu_object_free(os, object, tx));
     1471 +                VERIFY0(dmu_object_free(os, object, tx));
1472 1472          }
1473 1473  
1474      -        VERIFY3U(0, ==, zap_remove(os, lr->lr_doid, name, tx));
     1474 +        VERIFY0(zap_remove(os, lr->lr_doid, name, tx));
1475 1475  
1476 1476          (void) ztest_log_remove(zd, tx, lr, object);
1477 1477  
1478 1478          dmu_tx_commit(tx);
1479 1479  
1480 1480          ztest_object_unlock(zd, object);
1481 1481  
1482 1482          return (0);
1483 1483  }
1484 1484  
↓ open down ↓ 29 lines elided ↑ open up ↑
1514 1514  
1515 1515          if (bt->bt_magic == BSWAP_64(BT_MAGIC))
1516 1516                  byteswap_uint64_array(bt, sizeof (*bt));
1517 1517  
1518 1518          if (bt->bt_magic != BT_MAGIC)
1519 1519                  bt = NULL;
1520 1520  
1521 1521          ztest_object_lock(zd, lr->lr_foid, RL_READER);
1522 1522          rl = ztest_range_lock(zd, lr->lr_foid, offset, length, RL_WRITER);
1523 1523  
1524      -        VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
     1524 +        VERIFY0(dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1525 1525  
1526 1526          dmu_object_info_from_db(db, &doi);
1527 1527  
1528 1528          bbt = ztest_bt_bonus(db);
1529 1529          ASSERT3U(bbt->bt_magic, ==, BT_MAGIC);
1530 1530          gen = bbt->bt_gen;
1531 1531          crtxg = bbt->bt_crtxg;
1532 1532          lrtxg = lr->lr_common.lrc_txg;
1533 1533  
1534 1534          tx = dmu_tx_create(os);
↓ open down ↓ 118 lines elided ↑ open up ↑
1653 1653          dmu_tx_t *tx;
1654 1654          dmu_buf_t *db;
1655 1655          ztest_block_tag_t *bbt;
1656 1656          uint64_t txg, lrtxg, crtxg;
1657 1657  
1658 1658          if (byteswap)
1659 1659                  byteswap_uint64_array(lr, sizeof (*lr));
1660 1660  
1661 1661          ztest_object_lock(zd, lr->lr_foid, RL_WRITER);
1662 1662  
1663      -        VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
     1663 +        VERIFY0(dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
1664 1664  
1665 1665          tx = dmu_tx_create(os);
1666 1666          dmu_tx_hold_bonus(tx, lr->lr_foid);
1667 1667  
1668 1668          txg = ztest_tx_assign(tx, TXG_WAIT, FTAG);
1669 1669          if (txg == 0) {
1670 1670                  dmu_buf_rele(db, FTAG);
1671 1671                  ztest_object_unlock(zd, lr->lr_foid);
1672 1672                  return (ENOSPC);
1673 1673          }
↓ open down ↓ 20 lines elided ↑ open up ↑
1694 1694          /*
1695 1695           * Verify that the current bonus buffer is not newer than our txg.
1696 1696           */
1697 1697          ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode,
1698 1698              MAX(txg, lrtxg), crtxg);
1699 1699  
1700 1700          dmu_buf_will_dirty(db, tx);
1701 1701  
1702 1702          ASSERT3U(lr->lr_size, >=, sizeof (*bbt));
1703 1703          ASSERT3U(lr->lr_size, <=, db->db_size);
1704      -        VERIFY3U(dmu_set_bonus(db, lr->lr_size, tx), ==, 0);
     1704 +        VERIFY0(dmu_set_bonus(db, lr->lr_size, tx));
1705 1705          bbt = ztest_bt_bonus(db);
1706 1706  
1707 1707          ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg);
1708 1708  
1709 1709          dmu_buf_rele(db, FTAG);
1710 1710  
1711 1711          (void) ztest_log_setattr(zd, tx, lr);
1712 1712  
1713 1713          dmu_tx_commit(tx);
1714 1714  
↓ open down ↓ 171 lines elided ↑ open up ↑
1886 1886                          missing++;
1887 1887                  } else {
1888 1888                          dmu_buf_t *db;
1889 1889                          ztest_block_tag_t *bbt;
1890 1890                          dmu_object_info_t doi;
1891 1891  
1892 1892                          ASSERT(od->od_object != 0);
1893 1893                          ASSERT(missing == 0);   /* there should be no gaps */
1894 1894  
1895 1895                          ztest_object_lock(zd, od->od_object, RL_READER);
1896      -                        VERIFY3U(0, ==, dmu_bonus_hold(zd->zd_os,
     1896 +                        VERIFY0(dmu_bonus_hold(zd->zd_os,
1897 1897                              od->od_object, FTAG, &db));
1898 1898                          dmu_object_info_from_db(db, &doi);
1899 1899                          bbt = ztest_bt_bonus(db);
1900 1900                          ASSERT3U(bbt->bt_magic, ==, BT_MAGIC);
1901 1901                          od->od_type = doi.doi_type;
1902 1902                          od->od_blocksize = doi.doi_data_block_size;
1903 1903                          od->od_gen = bbt->bt_gen;
1904 1904                          dmu_buf_rele(db, FTAG);
1905 1905                          ztest_object_unlock(zd, od->od_object);
1906 1906                  }
↓ open down ↓ 357 lines elided ↑ open up ↑
2264 2264          nvlist_free(nvroot);
2265 2265  
2266 2266          /*
2267 2267           * Attempt to create an existing pool.  It shouldn't matter
2268 2268           * what's in the nvroot; we should fail with EEXIST.
2269 2269           */
2270 2270          (void) rw_rdlock(&ztest_name_lock);
2271 2271          nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
2272 2272          VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL));
2273 2273          nvlist_free(nvroot);
2274      -        VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG));
     2274 +        VERIFY0(spa_open(zo->zo_pool, &spa, FTAG));
2275 2275          VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool));
2276 2276          spa_close(spa, FTAG);
2277 2277  
2278 2278          (void) rw_unlock(&ztest_name_lock);
2279 2279  }
2280 2280  
2281 2281  static vdev_t *
2282 2282  vdev_lookup_by_path(vdev_t *vd, const char *path)
2283 2283  {
2284 2284          vdev_t *mvd;
↓ open down ↓ 738 lines elided ↑ open up ↑
3023 3023  static int
3024 3024  ztest_objset_destroy_cb(const char *name, void *arg)
3025 3025  {
3026 3026          objset_t *os;
3027 3027          dmu_object_info_t doi;
3028 3028          int error;
3029 3029  
3030 3030          /*
3031 3031           * Verify that the dataset contains a directory object.
3032 3032           */
3033      -        VERIFY3U(0, ==, dmu_objset_hold(name, FTAG, &os));
     3033 +        VERIFY0(dmu_objset_hold(name, FTAG, &os));
3034 3034          error = dmu_object_info(os, ZTEST_DIROBJ, &doi);
3035 3035          if (error != ENOENT) {
3036 3036                  /* We could have crashed in the middle of destroying it */
3037      -                ASSERT3U(error, ==, 0);
     3037 +                ASSERT0(error);
3038 3038                  ASSERT3U(doi.doi_type, ==, DMU_OT_ZAP_OTHER);
3039 3039                  ASSERT3S(doi.doi_physical_blocks_512, >=, 0);
3040 3040          }
3041 3041          dmu_objset_rele(os, FTAG);
3042 3042  
3043 3043          /*
3044 3044           * Destroy the dataset.
3045 3045           */
3046      -        VERIFY3U(0, ==, dmu_objset_destroy(name, B_FALSE));
     3046 +        VERIFY0(dmu_objset_destroy(name, B_FALSE));
3047 3047          return (0);
3048 3048  }
3049 3049  
3050 3050  static boolean_t
3051 3051  ztest_snapshot_create(char *osname, uint64_t id)
3052 3052  {
3053 3053          char snapname[MAXNAMELEN];
3054 3054          int error;
3055 3055  
3056 3056          (void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
↓ open down ↓ 72 lines elided ↑ open up ↑
3129 3129          error = ztest_dataset_create(name);
3130 3130          if (error) {
3131 3131                  if (error == ENOSPC) {
3132 3132                          ztest_record_enospc(FTAG);
3133 3133                          (void) rw_unlock(&ztest_name_lock);
3134 3134                          return;
3135 3135                  }
3136 3136                  fatal(0, "dmu_objset_create(%s) = %d", name, error);
3137 3137          }
3138 3138  
3139      -        VERIFY3U(0, ==,
3140      -            dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
     3139 +        VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
3141 3140  
3142 3141          ztest_zd_init(&zdtmp, NULL, os);
3143 3142  
3144 3143          /*
3145 3144           * Open the intent log for it.
3146 3145           */
3147 3146          zilog = zil_open(os, ztest_get_data);
3148 3147  
3149 3148          /*
3150 3149           * Put some objects in there, do a little I/O to them,
↓ open down ↓ 8 lines elided ↑ open up ↑
3159 3158  
3160 3159          /*
3161 3160           * Verify that we cannot create an existing dataset.
3162 3161           */
3163 3162          VERIFY3U(EEXIST, ==,
3164 3163              dmu_objset_create(name, DMU_OST_OTHER, 0, NULL, NULL));
3165 3164  
3166 3165          /*
3167 3166           * Verify that we can hold an objset that is also owned.
3168 3167           */
3169      -        VERIFY3U(0, ==, dmu_objset_hold(name, FTAG, &os2));
     3168 +        VERIFY0(dmu_objset_hold(name, FTAG, &os2));
3170 3169          dmu_objset_rele(os2, FTAG);
3171 3170  
3172 3171          /*
3173 3172           * Verify that we cannot own an objset that is already owned.
3174 3173           */
3175 3174          VERIFY3U(EBUSY, ==,
3176 3175              dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os2));
3177 3176  
3178 3177          zil_close(zilog);
3179 3178          dmu_objset_disown(os, FTAG);
↓ open down ↓ 256 lines elided ↑ open up ↑
3436 3435           * free_percent of the time, free a range of bigobj rather than
3437 3436           * overwriting it.
3438 3437           */
3439 3438          freeit = (ztest_random(100) < free_percent);
3440 3439  
3441 3440          /*
3442 3441           * Read the current contents of our objects.
3443 3442           */
3444 3443          error = dmu_read(os, packobj, packoff, packsize, packbuf,
3445 3444              DMU_READ_PREFETCH);
3446      -        ASSERT3U(error, ==, 0);
     3445 +        ASSERT0(error);
3447 3446          error = dmu_read(os, bigobj, bigoff, bigsize, bigbuf,
3448 3447              DMU_READ_PREFETCH);
3449      -        ASSERT3U(error, ==, 0);
     3448 +        ASSERT0(error);
3450 3449  
3451 3450          /*
3452 3451           * Get a tx for the mods to both packobj and bigobj.
3453 3452           */
3454 3453          tx = dmu_tx_create(os);
3455 3454  
3456 3455          dmu_tx_hold_write(tx, packobj, packoff, packsize);
3457 3456  
3458 3457          if (freeit)
3459 3458                  dmu_tx_hold_free(tx, bigobj, bigoff, bigsize);
↓ open down ↓ 219 lines elided ↑ open up ↑
3679 3678  
3680 3679          packoff = n * sizeof (bufwad_t);
3681 3680          packsize = s * sizeof (bufwad_t);
3682 3681  
3683 3682          bigoff = n * chunksize;
3684 3683          bigsize = s * chunksize;
3685 3684  
3686 3685          packbuf = umem_zalloc(packsize, UMEM_NOFAIL);
3687 3686          bigbuf = umem_zalloc(bigsize, UMEM_NOFAIL);
3688 3687  
3689      -        VERIFY3U(0, ==, dmu_bonus_hold(os, bigobj, FTAG, &bonus_db));
     3688 +        VERIFY0(dmu_bonus_hold(os, bigobj, FTAG, &bonus_db));
3690 3689  
3691 3690          bigbuf_arcbufs = umem_zalloc(2 * s * sizeof (arc_buf_t *), UMEM_NOFAIL);
3692 3691  
3693 3692          /*
3694 3693           * Iteration 0 test zcopy for DB_UNCACHED dbufs.
3695 3694           * Iteration 1 test zcopy to already referenced dbufs.
3696 3695           * Iteration 2 test zcopy to dirty dbuf in the same txg.
3697 3696           * Iteration 3 test zcopy to dbuf dirty in previous txg.
3698 3697           * Iteration 4 test zcopy when dbuf is no longer dirty.
3699 3698           * Iteration 5 test zcopy when it can't be done.
↓ open down ↓ 49 lines elided ↑ open up ↑
3749 3748                  }
3750 3749  
3751 3750                  /*
3752 3751                   * 50% of the time don't read objects in the 1st iteration to
3753 3752                   * test dmu_assign_arcbuf() for the case when there're no
3754 3753                   * existing dbufs for the specified offsets.
3755 3754                   */
3756 3755                  if (i != 0 || ztest_random(2) != 0) {
3757 3756                          error = dmu_read(os, packobj, packoff,
3758 3757                              packsize, packbuf, DMU_READ_PREFETCH);
3759      -                        ASSERT3U(error, ==, 0);
     3758 +                        ASSERT0(error);
3760 3759                          error = dmu_read(os, bigobj, bigoff, bigsize,
3761 3760                              bigbuf, DMU_READ_PREFETCH);
3762      -                        ASSERT3U(error, ==, 0);
     3761 +                        ASSERT0(error);
3763 3762                  }
3764 3763                  compare_and_update_pbbufs(s, packbuf, bigbuf, bigsize,
3765 3764                      n, chunksize, txg);
3766 3765  
3767 3766                  /*
3768 3767                   * We've verified all the old bufwads, and made new ones.
3769 3768                   * Now write them out.
3770 3769                   */
3771 3770                  dmu_write(os, packobj, packoff, packsize, packbuf, tx);
3772 3771                  if (ztest_opts.zo_verbose >= 7) {
↓ open down ↓ 158 lines elided ↑ open up ↑
3931 3930           * Generate a known hash collision, and verify that
3932 3931           * we can lookup and remove both entries.
3933 3932           */
3934 3933          tx = dmu_tx_create(os);
3935 3934          dmu_tx_hold_zap(tx, object, B_TRUE, NULL);
3936 3935          txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
3937 3936          if (txg == 0)
3938 3937                  return;
3939 3938          for (i = 0; i < 2; i++) {
3940 3939                  value[i] = i;
3941      -                VERIFY3U(0, ==, zap_add(os, object, hc[i], sizeof (uint64_t),
     3940 +                VERIFY0(zap_add(os, object, hc[i], sizeof (uint64_t),
3942 3941                      1, &value[i], tx));
3943 3942          }
3944 3943          for (i = 0; i < 2; i++) {
3945 3944                  VERIFY3U(EEXIST, ==, zap_add(os, object, hc[i],
3946 3945                      sizeof (uint64_t), 1, &value[i], tx));
3947      -                VERIFY3U(0, ==,
3948      -                    zap_length(os, object, hc[i], &zl_intsize, &zl_ints));
     3946 +                VERIFY0(zap_length(os, object, hc[i], &zl_intsize, &zl_ints));
3949 3947                  ASSERT3U(zl_intsize, ==, sizeof (uint64_t));
3950 3948                  ASSERT3U(zl_ints, ==, 1);
3951 3949          }
3952 3950          for (i = 0; i < 2; i++) {
3953      -                VERIFY3U(0, ==, zap_remove(os, object, hc[i], tx));
     3951 +                VERIFY0(zap_remove(os, object, hc[i], tx));
3954 3952          }
3955 3953          dmu_tx_commit(tx);
3956 3954  
3957 3955          /*
3958 3956           * Generate a buch of random entries.
3959 3957           */
3960 3958          ints = MAX(ZTEST_ZAP_MIN_INTS, object % ZTEST_ZAP_MAX_INTS);
3961 3959  
3962 3960          prop = ztest_random(ZTEST_ZAP_MAX_PROPS);
3963 3961          (void) sprintf(propname, "prop_%llu", (u_longlong_t)prop);
↓ open down ↓ 40 lines elided ↑ open up ↑
4004 4002          txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
4005 4003          if (txg == 0)
4006 4004                  return;
4007 4005  
4008 4006          if (last_txg > txg)
4009 4007                  fatal(0, "zap future leak: old %llu new %llu", last_txg, txg);
4010 4008  
4011 4009          for (i = 0; i < ints; i++)
4012 4010                  value[i] = txg + object + i;
4013 4011  
4014      -        VERIFY3U(0, ==, zap_update(os, object, txgname, sizeof (uint64_t),
     4012 +        VERIFY0(zap_update(os, object, txgname, sizeof (uint64_t),
4015 4013              1, &txg, tx));
4016      -        VERIFY3U(0, ==, zap_update(os, object, propname, sizeof (uint64_t),
     4014 +        VERIFY0(zap_update(os, object, propname, sizeof (uint64_t),
4017 4015              ints, value, tx));
4018 4016  
4019 4017          dmu_tx_commit(tx);
4020 4018  
4021 4019          /*
4022 4020           * Remove a random pair of entries.
4023 4021           */
4024 4022          prop = ztest_random(ZTEST_ZAP_MAX_PROPS);
4025 4023          (void) sprintf(propname, "prop_%llu", (u_longlong_t)prop);
4026 4024          (void) sprintf(txgname, "txg_%llu", (u_longlong_t)prop);
4027 4025  
4028 4026          error = zap_length(os, object, txgname, &zl_intsize, &zl_ints);
4029 4027  
4030 4028          if (error == ENOENT)
4031 4029                  return;
4032 4030  
4033      -        ASSERT3U(error, ==, 0);
     4031 +        ASSERT0(error);
4034 4032  
4035 4033          tx = dmu_tx_create(os);
4036 4034          dmu_tx_hold_zap(tx, object, B_TRUE, NULL);
4037 4035          txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
4038 4036          if (txg == 0)
4039 4037                  return;
4040      -        VERIFY3U(0, ==, zap_remove(os, object, txgname, tx));
4041      -        VERIFY3U(0, ==, zap_remove(os, object, propname, tx));
     4038 +        VERIFY0(zap_remove(os, object, txgname, tx));
     4039 +        VERIFY0(zap_remove(os, object, propname, tx));
4042 4040          dmu_tx_commit(tx);
4043 4041  }
4044 4042  
4045 4043  /*
4046 4044   * Testcase to test the upgrading of a microzap to fatzap.
4047 4045   */
4048 4046  void
4049 4047  ztest_fzap(ztest_ds_t *zd, uint64_t id)
4050 4048  {
4051 4049          objset_t *os = zd->zd_os;
↓ open down ↓ 167 lines elided ↑ open up ↑
4219 4217  
4220 4218          synced_txg = spa_last_synced_txg(data->zcd_spa);
4221 4219          if (data->zcd_txg > synced_txg)
4222 4220                  fatal(0, "commit callback of txg %" PRIu64 " called prematurely"
4223 4221                      ", last synced txg = %" PRIu64 "\n", data->zcd_txg,
4224 4222                      synced_txg);
4225 4223  
4226 4224          data->zcd_called = B_TRUE;
4227 4225  
4228 4226          if (error == ECANCELED) {
4229      -                ASSERT3U(data->zcd_txg, ==, 0);
     4227 +                ASSERT0(data->zcd_txg);
4230 4228                  ASSERT(!data->zcd_added);
4231 4229  
4232 4230                  /*
4233 4231                   * The private callback data should be destroyed here, but
4234 4232                   * since we are going to check the zcd_called field after
4235 4233                   * dmu_tx_abort(), we will destroy it there.
4236 4234                   */
4237 4235                  return;
4238 4236          }
4239 4237  
↓ open down ↓ 184 lines elided ↑ open up ↑
4424 4422  void
4425 4423  ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id)
4426 4424  {
4427 4425          nvlist_t *props = NULL;
4428 4426  
4429 4427          (void) rw_rdlock(&ztest_name_lock);
4430 4428  
4431 4429          (void) ztest_spa_prop_set_uint64(ZPOOL_PROP_DEDUPDITTO,
4432 4430              ZIO_DEDUPDITTO_MIN + ztest_random(ZIO_DEDUPDITTO_MIN));
4433 4431  
4434      -        VERIFY3U(spa_prop_get(ztest_spa, &props), ==, 0);
     4432 +        VERIFY0(spa_prop_get(ztest_spa, &props));
4435 4433  
4436 4434          if (ztest_opts.zo_verbose >= 6)
4437 4435                  dump_nvlist(props, 4);
4438 4436  
4439 4437          nvlist_free(props);
4440 4438  
4441 4439          (void) rw_unlock(&ztest_name_lock);
4442 4440  }
4443 4441  
4444 4442  /*
↓ open down ↓ 435 lines elided ↑ open up ↑
4880 4878          (void) rw_wrlock(&ztest_name_lock);
4881 4879  
4882 4880          oldname = ztest_opts.zo_pool;
4883 4881          newname = umem_alloc(strlen(oldname) + 5, UMEM_NOFAIL);
4884 4882          (void) strcpy(newname, oldname);
4885 4883          (void) strcat(newname, "_tmp");
4886 4884  
4887 4885          /*
4888 4886           * Do the rename
4889 4887           */
4890      -        VERIFY3U(0, ==, spa_rename(oldname, newname));
     4888 +        VERIFY0(spa_rename(oldname, newname));
4891 4889  
4892 4890          /*
4893 4891           * Try to open it under the old name, which shouldn't exist
4894 4892           */
4895 4893          VERIFY3U(ENOENT, ==, spa_open(oldname, &spa, FTAG));
4896 4894  
4897 4895          /*
4898 4896           * Open it under the new name and make sure it's still the same spa_t.
4899 4897           */
4900      -        VERIFY3U(0, ==, spa_open(newname, &spa, FTAG));
     4898 +        VERIFY0(spa_open(newname, &spa, FTAG));
4901 4899  
4902 4900          ASSERT(spa == ztest_spa);
4903 4901          spa_close(spa, FTAG);
4904 4902  
4905 4903          /*
4906 4904           * Rename it back to the original
4907 4905           */
4908      -        VERIFY3U(0, ==, spa_rename(newname, oldname));
     4906 +        VERIFY0(spa_rename(newname, oldname));
4909 4907  
4910 4908          /*
4911 4909           * Make sure it can still be opened
4912 4910           */
4913      -        VERIFY3U(0, ==, spa_open(oldname, &spa, FTAG));
     4911 +        VERIFY0(spa_open(oldname, &spa, FTAG));
4914 4912  
4915 4913          ASSERT(spa == ztest_spa);
4916 4914          spa_close(spa, FTAG);
4917 4915  
4918 4916          umem_free(newname, strlen(newname) + 1);
4919 4917  
4920 4918          (void) rw_unlock(&ztest_name_lock);
4921 4919  }
4922 4920  
4923 4921  /*
↓ open down ↓ 79 lines elided ↑ open up ↑
5003 5001          }
5004 5002  
5005 5003          /*
5006 5004           * Clean up from previous runs.
5007 5005           */
5008 5006          (void) spa_destroy(newname);
5009 5007  
5010 5008          /*
5011 5009           * Get the pool's configuration and guid.
5012 5010           */
5013      -        VERIFY3U(0, ==, spa_open(oldname, &spa, FTAG));
     5011 +        VERIFY0(spa_open(oldname, &spa, FTAG));
5014 5012  
5015 5013          /*
5016 5014           * Kick off a scrub to tickle scrub/export races.
5017 5015           */
5018 5016          if (ztest_random(2) == 0)
5019 5017                  (void) spa_scan(spa, POOL_SCAN_SCRUB);
5020 5018  
5021 5019          pool_guid = spa_guid(spa);
5022 5020          spa_close(spa, FTAG);
5023 5021  
5024 5022          ztest_walk_pool_directory("pools before export");
5025 5023  
5026 5024          /*
5027 5025           * Export it.
5028 5026           */
5029      -        VERIFY3U(0, ==, spa_export(oldname, &config, B_FALSE, B_FALSE));
     5027 +        VERIFY0(spa_export(oldname, &config, B_FALSE, B_FALSE));
5030 5028  
5031 5029          ztest_walk_pool_directory("pools after export");
5032 5030  
5033 5031          /*
5034 5032           * Try to import it.
5035 5033           */
5036 5034          newconfig = spa_tryimport(config);
5037 5035          ASSERT(newconfig != NULL);
5038 5036          nvlist_free(newconfig);
5039 5037  
5040 5038          /*
5041 5039           * Import it under the new name.
5042 5040           */
5043      -        VERIFY3U(0, ==, spa_import(newname, config, NULL, 0));
     5041 +        VERIFY0(spa_import(newname, config, NULL, 0));
5044 5042  
5045 5043          ztest_walk_pool_directory("pools after import");
5046 5044  
5047 5045          /*
5048 5046           * Try to import it again -- should fail with EEXIST.
5049 5047           */
5050 5048          VERIFY3U(EEXIST, ==, spa_import(newname, config, NULL, 0));
5051 5049  
5052 5050          /*
5053 5051           * Try to import it under a different name -- should fail with EEXIST.
↓ open down ↓ 1 lines elided ↑ open up ↑
5055 5053          VERIFY3U(EEXIST, ==, spa_import(oldname, config, NULL, 0));
5056 5054  
5057 5055          /*
5058 5056           * Verify that the pool is no longer visible under the old name.
5059 5057           */
5060 5058          VERIFY3U(ENOENT, ==, spa_open(oldname, &spa, FTAG));
5061 5059  
5062 5060          /*
5063 5061           * Verify that we can open and close the pool using the new name.
5064 5062           */
5065      -        VERIFY3U(0, ==, spa_open(newname, &spa, FTAG));
     5063 +        VERIFY0(spa_open(newname, &spa, FTAG));
5066 5064          ASSERT(pool_guid == spa_guid(spa));
5067 5065          spa_close(spa, FTAG);
5068 5066  
5069 5067          nvlist_free(config);
5070 5068  }
5071 5069  
5072 5070  static void
5073 5071  ztest_resume(spa_t *spa)
5074 5072  {
5075 5073          if (spa_suspended(spa) && ztest_opts.zo_verbose >= 6)
↓ open down ↓ 137 lines elided ↑ open up ↑
5213 5211           * ZTEST_DIROBJ is the object directory for the entire dataset.
5214 5212           * Therefore, the number of objects in use should equal the
5215 5213           * number of ZTEST_DIROBJ entries, +1 for ZTEST_DIROBJ itself.
5216 5214           * If not, we have an object leak.
5217 5215           *
5218 5216           * Note that we can only check this in ztest_dataset_open(),
5219 5217           * when the open-context and syncing-context values agree.
5220 5218           * That's because zap_count() returns the open-context value,
5221 5219           * while dmu_objset_space() returns the rootbp fill count.
5222 5220           */
5223      -        VERIFY3U(0, ==, zap_count(zd->zd_os, ZTEST_DIROBJ, &dirobjs));
     5221 +        VERIFY0(zap_count(zd->zd_os, ZTEST_DIROBJ, &dirobjs));
5224 5222          dmu_objset_space(zd->zd_os, &scratch, &scratch, &usedobjs, &scratch);
5225 5223          ASSERT3U(dirobjs + 1, ==, usedobjs);
5226 5224  }
5227 5225  
5228 5226  static int
5229 5227  ztest_dataset_open(int d)
5230 5228  {
5231 5229          ztest_ds_t *zd = &ztest_ds[d];
5232 5230          uint64_t committed_seq = ZTEST_GET_SHARED_DS(d)->zd_seq;
5233 5231          objset_t *os;
↓ open down ↓ 6 lines elided ↑ open up ↑
5240 5238          (void) rw_rdlock(&ztest_name_lock);
5241 5239  
5242 5240          error = ztest_dataset_create(name);
5243 5241          if (error == ENOSPC) {
5244 5242                  (void) rw_unlock(&ztest_name_lock);
5245 5243                  ztest_record_enospc(FTAG);
5246 5244                  return (error);
5247 5245          }
5248 5246          ASSERT(error == 0 || error == EEXIST);
5249 5247  
5250      -        VERIFY3U(dmu_objset_hold(name, zd, &os), ==, 0);
     5248 +        VERIFY0(dmu_objset_hold(name, zd, &os));
5251 5249          (void) rw_unlock(&ztest_name_lock);
5252 5250  
5253 5251          ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os);
5254 5252  
5255 5253          zilog = zd->zd_zilog;
5256 5254  
5257 5255          if (zilog->zl_header->zh_claim_lr_seq != 0 &&
5258 5256              zilog->zl_header->zh_claim_lr_seq < committed_seq)
5259 5257                  fatal(0, "missing log records: claimed %llu < committed %llu",
5260 5258                      zilog->zl_header->zh_claim_lr_seq, committed_seq);
↓ open down ↓ 68 lines elided ↑ open up ↑
5329 5327              offsetof(ztest_cb_data_t, zcd_node));
5330 5328  
5331 5329          /*
5332 5330           * Open our pool.
5333 5331           */
5334 5332          kernel_init(FREAD | FWRITE);
5335 5333          VERIFY(spa_open(ztest_opts.zo_pool, &spa, FTAG) == 0);
5336 5334          spa->spa_debug = B_TRUE;
5337 5335          ztest_spa = spa;
5338 5336  
5339      -        VERIFY3U(0, ==, dmu_objset_hold(ztest_opts.zo_pool, FTAG, &os));
     5337 +        VERIFY0(dmu_objset_hold(ztest_opts.zo_pool, FTAG, &os));
5340 5338          zs->zs_guid = dmu_objset_fsid_guid(os);
5341 5339          dmu_objset_rele(os, FTAG);
5342 5340  
5343 5341          spa->spa_dedup_ditto = 2 * ZIO_DEDUPDITTO_MIN;
5344 5342  
5345 5343          /*
5346 5344           * We don't expect the pool to suspend unless maxfaults == 0,
5347 5345           * in which case ztest_fault_inject() temporarily takes away
5348 5346           * the only valid replica.
5349 5347           */
↓ open down ↓ 121 lines elided ↑ open up ↑
5471 5469  ztest_freeze(void)
5472 5470  {
5473 5471          ztest_ds_t *zd = &ztest_ds[0];
5474 5472          spa_t *spa;
5475 5473          int numloops = 0;
5476 5474  
5477 5475          if (ztest_opts.zo_verbose >= 3)
5478 5476                  (void) printf("testing spa_freeze()...\n");
5479 5477  
5480 5478          kernel_init(FREAD | FWRITE);
5481      -        VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
5482      -        VERIFY3U(0, ==, ztest_dataset_open(0));
     5479 +        VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
     5480 +        VERIFY0(ztest_dataset_open(0));
5483 5481  
5484 5482          /*
5485 5483           * Force the first log block to be transactionally allocated.
5486 5484           * We have to do this before we freeze the pool -- otherwise
5487 5485           * the log chain won't be anchored.
5488 5486           */
5489 5487          while (BP_IS_HOLE(&zd->zd_zilog->zl_header->zh_log)) {
5490 5488                  ztest_dmu_object_alloc_free(zd, 0);
5491 5489                  zil_commit(zd->zd_zilog, 0);
5492 5490          }
↓ open down ↓ 30 lines elided ↑ open up ↑
5523 5521           * Close our dataset and close the pool.
5524 5522           */
5525 5523          ztest_dataset_close(0);
5526 5524          spa_close(spa, FTAG);
5527 5525          kernel_fini();
5528 5526  
5529 5527          /*
5530 5528           * Open and close the pool and dataset to induce log replay.
5531 5529           */
5532 5530          kernel_init(FREAD | FWRITE);
5533      -        VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
5534      -        VERIFY3U(0, ==, ztest_dataset_open(0));
     5531 +        VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
     5532 +        VERIFY0(ztest_dataset_open(0));
5535 5533          ztest_dataset_close(0);
5536 5534          spa_close(spa, FTAG);
5537 5535          kernel_fini();
5538 5536  }
5539 5537  
5540 5538  void
5541 5539  print_time(hrtime_t t, char *timebuf)
5542 5540  {
5543 5541          hrtime_t s = t / NANOSEC;
5544 5542          hrtime_t m = s / 60;
↓ open down ↓ 52 lines elided ↑ open up ↑
5597 5595          ztest_shared->zs_vdev_next_leaf = 0;
5598 5596          zs->zs_splits = 0;
5599 5597          zs->zs_mirrors = ztest_opts.zo_mirrors;
5600 5598          nvroot = make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0,
5601 5599              0, ztest_opts.zo_raidz, zs->zs_mirrors, 1);
5602 5600          props = make_random_props();
5603 5601          for (int i = 0; i < SPA_FEATURES; i++) {
5604 5602                  char buf[1024];
5605 5603                  (void) snprintf(buf, sizeof (buf), "feature@%s",
5606 5604                      spa_feature_table[i].fi_uname);
5607      -                VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0));
     5605 +                VERIFY0(nvlist_add_uint64(props, buf, 0));
5608 5606          }
5609      -        VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props, NULL));
     5607 +        VERIFY0(spa_create(ztest_opts.zo_pool, nvroot, props, NULL));
5610 5608          nvlist_free(nvroot);
5611 5609  
5612      -        VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
     5610 +        VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
5613 5611          zs->zs_metaslab_sz =
5614 5612              1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift;
5615 5613  
5616 5614          spa_close(spa, FTAG);
5617 5615  
5618 5616          kernel_fini();
5619 5617  
5620 5618          ztest_run_zdb(ztest_opts.zo_pool);
5621 5619  
5622 5620          ztest_freeze();
↓ open down ↓ 36 lines elided ↑ open up ↑
5659 5657  static void
5660 5658  setup_hdr(void)
5661 5659  {
5662 5660          int size;
5663 5661          ztest_shared_hdr_t *hdr;
5664 5662  
5665 5663          hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()),
5666 5664              PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0);
5667 5665          ASSERT(hdr != MAP_FAILED);
5668 5666  
5669      -        VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, sizeof (ztest_shared_hdr_t)));
     5667 +        VERIFY0(ftruncate(ZTEST_FD_DATA, sizeof (ztest_shared_hdr_t)));
5670 5668  
5671 5669          hdr->zh_hdr_size = sizeof (ztest_shared_hdr_t);
5672 5670          hdr->zh_opts_size = sizeof (ztest_shared_opts_t);
5673 5671          hdr->zh_size = sizeof (ztest_shared_t);
5674 5672          hdr->zh_stats_size = sizeof (ztest_shared_callstate_t);
5675 5673          hdr->zh_stats_count = ZTEST_FUNCS;
5676 5674          hdr->zh_ds_size = sizeof (ztest_shared_ds_t);
5677 5675          hdr->zh_ds_count = ztest_opts.zo_datasets;
5678 5676  
5679 5677          size = shared_data_size(hdr);
5680      -        VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, size));
     5678 +        VERIFY0(ftruncate(ZTEST_FD_DATA, size));
5681 5679  
5682 5680          (void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize()));
5683 5681  }
5684 5682  
5685 5683  static void
5686 5684  setup_data(void)
5687 5685  {
5688 5686          int size, offset;
5689 5687          ztest_shared_hdr_t *hdr;
5690 5688          uint8_t *buf;
↓ open down ↓ 313 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX