Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero
*** 829,839 ****
dsphys->ds_flags |= origin->ds_phys->ds_flags;
dmu_buf_will_dirty(origin->ds_dbuf, tx);
origin->ds_phys->ds_num_children++;
! VERIFY3U(0, ==, dsl_dataset_hold_obj(dp,
origin->ds_dir->dd_phys->dd_head_dataset_obj, FTAG, &ohds));
dsphys->ds_deadlist_obj = dsl_deadlist_clone(&ohds->ds_deadlist,
dsphys->ds_prev_snap_txg, dsphys->ds_prev_snap_obj, tx);
dsl_dataset_rele(ohds, FTAG);
--- 829,839 ----
dsphys->ds_flags |= origin->ds_phys->ds_flags;
dmu_buf_will_dirty(origin->ds_dbuf, tx);
origin->ds_phys->ds_num_children++;
! VERIFY0(dsl_dataset_hold_obj(dp,
origin->ds_dir->dd_phys->dd_head_dataset_obj, FTAG, &ohds));
dsphys->ds_deadlist_obj = dsl_deadlist_clone(&ohds->ds_deadlist,
dsphys->ds_prev_snap_txg, dsphys->ds_prev_snap_obj, tx);
dsl_dataset_rele(ohds, FTAG);
*** 855,865 ****
dmu_buf_will_dirty(origin->ds_dir->dd_dbuf, tx);
origin->ds_dir->dd_phys->dd_clones =
zap_create(mos,
DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
}
! VERIFY3U(0, ==, zap_add_int(mos,
origin->ds_dir->dd_phys->dd_clones, dsobj, tx));
}
}
if (spa_version(dp->dp_spa) >= SPA_VERSION_UNIQUE_ACCURATE)
--- 855,865 ----
dmu_buf_will_dirty(origin->ds_dir->dd_dbuf, tx);
origin->ds_dir->dd_phys->dd_clones =
zap_create(mos,
DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
}
! VERIFY0(zap_add_int(mos,
origin->ds_dir->dd_phys->dd_clones, dsobj, tx));
}
}
if (spa_version(dp->dp_spa) >= SPA_VERSION_UNIQUE_ACCURATE)
*** 898,909 ****
*/
if (origin != NULL) {
dsl_dataset_t *ds;
objset_t *os;
! VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
! VERIFY3U(0, ==, dmu_objset_from_ds(ds, &os));
bzero(&os->os_zil_header, sizeof (os->os_zil_header));
dsl_dataset_dirty(ds, tx);
dsl_dataset_rele(ds, FTAG);
}
--- 898,909 ----
*/
if (origin != NULL) {
dsl_dataset_t *ds;
objset_t *os;
! VERIFY0(dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
! VERIFY0(dmu_objset_from_ds(ds, &os));
bzero(&os->os_zil_header, sizeof (os->os_zil_header));
dsl_dataset_dirty(ds, tx);
dsl_dataset_rele(ds, FTAG);
}
*** 1502,1515 ****
* ENOENT. However, at least we can check that we don't have
* too many entries in the next_clones_obj even after failing to
* remove this one.
*/
if (err != ENOENT) {
! VERIFY3U(err, ==, 0);
}
! ASSERT3U(0, ==, zap_count(mos, ds->ds_phys->ds_next_clones_obj,
! &count));
ASSERT3U(count, <=, ds->ds_phys->ds_num_children - 2);
}
static void
dsl_dataset_remove_clones_key(dsl_dataset_t *ds, uint64_t mintxg, dmu_tx_t *tx)
--- 1502,1514 ----
* ENOENT. However, at least we can check that we don't have
* too many entries in the next_clones_obj even after failing to
* remove this one.
*/
if (err != ENOENT) {
! VERIFY0(err);
}
! ASSERT0(zap_count(mos, ds->ds_phys->ds_next_clones_obj, &count));
ASSERT3U(count, <=, ds->ds_phys->ds_num_children - 2);
}
static void
dsl_dataset_remove_clones_key(dsl_dataset_t *ds, uint64_t mintxg, dmu_tx_t *tx)
*** 1529,1539 ****
for (zap_cursor_init(&zc, mos, ds->ds_dir->dd_phys->dd_clones);
zap_cursor_retrieve(&zc, &za) == 0;
zap_cursor_advance(&zc)) {
dsl_dataset_t *clone;
! VERIFY3U(0, ==, dsl_dataset_hold_obj(ds->ds_dir->dd_pool,
za.za_first_integer, FTAG, &clone));
if (clone->ds_dir->dd_origin_txg > mintxg) {
dsl_deadlist_remove_key(&clone->ds_deadlist,
mintxg, tx);
dsl_dataset_remove_clones_key(clone, mintxg, tx);
--- 1528,1538 ----
for (zap_cursor_init(&zc, mos, ds->ds_dir->dd_phys->dd_clones);
zap_cursor_retrieve(&zc, &za) == 0;
zap_cursor_advance(&zc)) {
dsl_dataset_t *clone;
! VERIFY0(dsl_dataset_hold_obj(ds->ds_dir->dd_pool,
za.za_first_integer, FTAG, &clone));
if (clone->ds_dir->dd_origin_txg > mintxg) {
dsl_deadlist_remove_key(&clone->ds_deadlist,
mintxg, tx);
dsl_dataset_remove_clones_key(clone, mintxg, tx);
*** 1587,1599 ****
poa.ds = ds;
poa.ds_prev = ds_prev;
poa.after_branch_point = after_branch_point;
poa.pio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
! VERIFY3U(0, ==, bpobj_iterate(&ds_next->ds_deadlist.dl_bpobj,
process_old_cb, &poa, tx));
! VERIFY3U(zio_wait(poa.pio), ==, 0);
ASSERT3U(poa.used, ==, ds->ds_phys->ds_unique_bytes);
/* change snapused */
dsl_dir_diduse_space(ds->ds_dir, DD_USED_SNAP,
-poa.used, -poa.comp, -poa.uncomp, tx);
--- 1586,1598 ----
poa.ds = ds;
poa.ds_prev = ds_prev;
poa.after_branch_point = after_branch_point;
poa.pio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
! VERIFY0(bpobj_iterate(&ds_next->ds_deadlist.dl_bpobj,
process_old_cb, &poa, tx));
! VERIFY0(zio_wait(poa.pio));
ASSERT3U(poa.used, ==, ds->ds_phys->ds_unique_bytes);
/* change snapused */
dsl_dir_diduse_space(ds->ds_dir, DD_USED_SNAP,
-poa.used, -poa.comp, -poa.uncomp, tx);
*** 1624,1634 ****
ka.ds = ds;
ka.tx = tx;
err = traverse_dataset(ds,
ds->ds_phys->ds_prev_snap_txg, TRAVERSE_POST,
kill_blkptr, &ka);
! ASSERT3U(err, ==, 0);
ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0);
return (err);
}
--- 1623,1633 ----
ka.ds = ds;
ka.tx = tx;
err = traverse_dataset(ds,
ds->ds_phys->ds_prev_snap_txg, TRAVERSE_POST,
kill_blkptr, &ka);
! ASSERT0(err);
ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0);
return (err);
}
*** 1680,1690 ****
(ZPROP_SRC_NONE | ZPROP_SRC_LOCAL | ZPROP_SRC_RECEIVED),
&value);
psa.psa_effective_value = 0; /* predict default value */
dsl_dataset_set_reservation_sync(ds, &psa, tx);
! ASSERT3U(ds->ds_reserved, ==, 0);
}
ASSERT(RW_WRITE_HELD(&dp->dp_config_rwlock));
dsl_scan_ds_destroyed(ds, tx);
--- 1679,1689 ----
(ZPROP_SRC_NONE | ZPROP_SRC_LOCAL | ZPROP_SRC_RECEIVED),
&value);
psa.psa_effective_value = 0; /* predict default value */
dsl_dataset_set_reservation_sync(ds, &psa, tx);
! ASSERT0(ds->ds_reserved);
}
ASSERT(RW_WRITE_HELD(&dp->dp_config_rwlock));
dsl_scan_ds_destroyed(ds, tx);
*** 1817,1827 ****
dsl_dataset_rele(ds_nextnext, FTAG);
ASSERT3P(ds_next->ds_prev, ==, NULL);
/* Collapse range in this head. */
dsl_dataset_t *hds;
! VERIFY3U(0, ==, dsl_dataset_hold_obj(dp,
ds->ds_dir->dd_phys->dd_head_dataset_obj,
FTAG, &hds));
dsl_deadlist_remove_key(&hds->ds_deadlist,
ds->ds_phys->ds_creation_txg, tx);
dsl_dataset_rele(hds, FTAG);
--- 1816,1826 ----
dsl_dataset_rele(ds_nextnext, FTAG);
ASSERT3P(ds_next->ds_prev, ==, NULL);
/* Collapse range in this head. */
dsl_dataset_t *hds;
! VERIFY0(dsl_dataset_hold_obj(dp,
ds->ds_dir->dd_phys->dd_head_dataset_obj,
FTAG, &hds));
dsl_deadlist_remove_key(&hds->ds_deadlist,
ds->ds_phys->ds_creation_txg, tx);
dsl_dataset_rele(hds, FTAG);
*** 1906,1916 ****
used, comp, uncomp, tx);
}
if (ds->ds_prev != NULL) {
if (spa_version(dp->dp_spa) >= SPA_VERSION_DIR_CLONES) {
! VERIFY3U(0, ==, zap_remove_int(mos,
ds->ds_prev->ds_dir->dd_phys->dd_clones,
ds->ds_object, tx));
}
dsl_dataset_rele(ds->ds_prev, ds);
ds->ds_prev = ds_prev = NULL;
--- 1905,1915 ----
used, comp, uncomp, tx);
}
if (ds->ds_prev != NULL) {
if (spa_version(dp->dp_spa) >= SPA_VERSION_DIR_CLONES) {
! VERIFY0(zap_remove_int(mos,
ds->ds_prev->ds_dir->dd_phys->dd_clones,
ds->ds_object, tx));
}
dsl_dataset_rele(ds->ds_prev, ds);
ds->ds_prev = ds_prev = NULL;
*** 1944,1954 ****
{
uint64_t val;
err = dsl_dataset_snap_lookup(ds_head,
ds->ds_snapname, &val);
! ASSERT3U(err, ==, 0);
ASSERT3U(val, ==, obj);
}
#endif
err = dsl_dataset_snap_remove(ds_head, ds->ds_snapname, tx);
ASSERT(err == 0);
--- 1943,1953 ----
{
uint64_t val;
err = dsl_dataset_snap_lookup(ds_head,
ds->ds_snapname, &val);
! ASSERT0(err);
ASSERT3U(val, ==, obj);
}
#endif
err = dsl_dataset_snap_remove(ds_head, ds->ds_snapname, tx);
ASSERT(err == 0);
*** 2111,2121 ****
ds->ds_prev->ds_phys->ds_creation_txg);
ds->ds_prev->ds_phys->ds_next_snap_obj = dsobj;
} else if (next_clones_obj != 0) {
remove_from_next_clones(ds->ds_prev,
dsphys->ds_next_snap_obj, tx);
! VERIFY3U(0, ==, zap_add_int(mos,
next_clones_obj, dsobj, tx));
}
}
/*
--- 2110,2120 ----
ds->ds_prev->ds_phys->ds_creation_txg);
ds->ds_prev->ds_phys->ds_next_snap_obj = dsobj;
} else if (next_clones_obj != 0) {
remove_from_next_clones(ds->ds_prev,
dsphys->ds_next_snap_obj, tx);
! VERIFY0(zap_add_int(mos,
next_clones_obj, dsobj, tx));
}
}
/*
*** 2201,2211 ****
* There may me missing entries in ds_next_clones_obj
* due to a bug in a previous version of the code.
* Only trust it if it has the right number of entries.
*/
if (ds->ds_phys->ds_next_clones_obj != 0) {
! ASSERT3U(0, ==, zap_count(mos, ds->ds_phys->ds_next_clones_obj,
&count));
}
if (count != ds->ds_phys->ds_num_children - 1) {
goto fail;
}
--- 2200,2210 ----
* There may me missing entries in ds_next_clones_obj
* due to a bug in a previous version of the code.
* Only trust it if it has the right number of entries.
*/
if (ds->ds_phys->ds_next_clones_obj != 0) {
! ASSERT0(zap_count(mos, ds->ds_phys->ds_next_clones_obj,
&count));
}
if (count != ds->ds_phys->ds_num_children - 1) {
goto fail;
}
*** 2440,2456 ****
VERIFY(0 == dsl_dataset_hold_obj(dd->dd_pool,
dd->dd_phys->dd_head_dataset_obj, FTAG, &hds));
VERIFY(0 == dsl_dataset_get_snapname(ds));
err = dsl_dataset_snap_remove(hds, ds->ds_snapname, tx);
! ASSERT3U(err, ==, 0);
mutex_enter(&ds->ds_lock);
(void) strcpy(ds->ds_snapname, newsnapname);
mutex_exit(&ds->ds_lock);
err = zap_add(mos, hds->ds_phys->ds_snapnames_zapobj,
ds->ds_snapname, 8, 1, &ds->ds_object, tx);
! ASSERT3U(err, ==, 0);
spa_history_log_internal_ds(ds, "rename", tx,
"-> @%s", newsnapname);
dsl_dataset_rele(hds, FTAG);
}
--- 2439,2455 ----
VERIFY(0 == dsl_dataset_hold_obj(dd->dd_pool,
dd->dd_phys->dd_head_dataset_obj, FTAG, &hds));
VERIFY(0 == dsl_dataset_get_snapname(ds));
err = dsl_dataset_snap_remove(hds, ds->ds_snapname, tx);
! ASSERT0(err);
mutex_enter(&ds->ds_lock);
(void) strcpy(ds->ds_snapname, newsnapname);
mutex_exit(&ds->ds_lock);
err = zap_add(mos, hds->ds_phys->ds_snapnames_zapobj,
ds->ds_snapname, 8, 1, &ds->ds_object, tx);
! ASSERT0(err);
spa_history_log_internal_ds(ds, "rename", tx,
"-> @%s", newsnapname);
dsl_dataset_rele(hds, FTAG);
}
*** 2804,2814 ****
origin_ds->ds_phys->ds_next_snap_obj = snap->ds->ds_object;
/* change the origin's next clone */
if (origin_ds->ds_phys->ds_next_clones_obj) {
remove_from_next_clones(origin_ds, snap->ds->ds_object, tx);
! VERIFY3U(0, ==, zap_add_int(dp->dp_meta_objset,
origin_ds->ds_phys->ds_next_clones_obj,
oldnext_obj, tx));
}
/* change origin */
--- 2803,2813 ----
origin_ds->ds_phys->ds_next_snap_obj = snap->ds->ds_object;
/* change the origin's next clone */
if (origin_ds->ds_phys->ds_next_clones_obj) {
remove_from_next_clones(origin_ds, snap->ds->ds_object, tx);
! VERIFY0(zap_add_int(dp->dp_meta_objset,
origin_ds->ds_phys->ds_next_clones_obj,
oldnext_obj, tx));
}
/* change origin */
*** 2821,2844 ****
origin_head->ds_dir->dd_origin_txg =
origin_ds->ds_phys->ds_creation_txg;
/* change dd_clone entries */
if (spa_version(dp->dp_spa) >= SPA_VERSION_DIR_CLONES) {
! VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
odd->dd_phys->dd_clones, hds->ds_object, tx));
! VERIFY3U(0, ==, zap_add_int(dp->dp_meta_objset,
pa->origin_origin->ds_dir->dd_phys->dd_clones,
hds->ds_object, tx));
! VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
pa->origin_origin->ds_dir->dd_phys->dd_clones,
origin_head->ds_object, tx));
if (dd->dd_phys->dd_clones == 0) {
dd->dd_phys->dd_clones = zap_create(dp->dp_meta_objset,
DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
}
! VERIFY3U(0, ==, zap_add_int(dp->dp_meta_objset,
dd->dd_phys->dd_clones, origin_head->ds_object, tx));
}
/* move snapshots to this dir */
--- 2820,2843 ----
origin_head->ds_dir->dd_origin_txg =
origin_ds->ds_phys->ds_creation_txg;
/* change dd_clone entries */
if (spa_version(dp->dp_spa) >= SPA_VERSION_DIR_CLONES) {
! VERIFY0(zap_remove_int(dp->dp_meta_objset,
odd->dd_phys->dd_clones, hds->ds_object, tx));
! VERIFY0(zap_add_int(dp->dp_meta_objset,
pa->origin_origin->ds_dir->dd_phys->dd_clones,
hds->ds_object, tx));
! VERIFY0(zap_remove_int(dp->dp_meta_objset,
pa->origin_origin->ds_dir->dd_phys->dd_clones,
origin_head->ds_object, tx));
if (dd->dd_phys->dd_clones == 0) {
dd->dd_phys->dd_clones = zap_create(dp->dp_meta_objset,
DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
}
! VERIFY0(zap_add_int(dp->dp_meta_objset,
dd->dd_phys->dd_clones, origin_head->ds_object, tx));
}
/* move snapshots to this dir */
*** 2887,2897 ****
* origin's reference.
*/
continue;
}
! VERIFY3U(0, ==, dsl_dataset_hold_obj(dp,
za.za_first_integer, FTAG, &cnds));
o = cnds->ds_dir->dd_phys->dd_head_dataset_obj;
VERIFY3U(zap_remove_int(dp->dp_meta_objset,
odd->dd_phys->dd_clones, o, tx), ==, 0);
--- 2886,2896 ----
* origin's reference.
*/
continue;
}
! VERIFY0(dsl_dataset_hold_obj(dp,
za.za_first_integer, FTAG, &cnds));
o = cnds->ds_dir->dd_phys->dd_head_dataset_obj;
VERIFY3U(zap_remove_int(dp->dp_meta_objset,
odd->dd_phys->dd_clones, o, tx), ==, 0);
*** 2900,2910 ****
dsl_dataset_rele(cnds, FTAG);
}
zap_cursor_fini(&zc);
}
! ASSERT3U(dsl_prop_numcb(ds), ==, 0);
}
/*
* Change space accounting.
* Note, pa->*usedsnap and dd_used_breakdown[SNAP] will either
--- 2899,2909 ----
dsl_dataset_rele(cnds, FTAG);
}
zap_cursor_fini(&zc);
}
! ASSERT0(dsl_prop_numcb(ds));
}
/*
* Change space accounting.
* Note, pa->*usedsnap and dd_used_breakdown[SNAP] will either
*** 3605,3615 ****
ca = kmem_alloc(sizeof (zfs_hold_cleanup_arg_t), KM_SLEEP);
ca->dp = ds->ds_dir->dd_pool;
ca->dsobj = ds->ds_object;
(void) strlcpy(ca->htag, htag, sizeof (ca->htag));
! VERIFY3U(0, ==, zfs_onexit_add_cb(minor,
dsl_dataset_user_release_onexit, ca, NULL));
}
/*
* If you add new checks here, you may need to add
--- 3604,3614 ----
ca = kmem_alloc(sizeof (zfs_hold_cleanup_arg_t), KM_SLEEP);
ca->dp = ds->ds_dir->dd_pool;
ca->dsobj = ds->ds_object;
(void) strlcpy(ca->htag, htag, sizeof (ca->htag));
! VERIFY0(zfs_onexit_add_cb(minor,
dsl_dataset_user_release_onexit, ca, NULL));
}
/*
* If you add new checks here, you may need to add