Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openzfs 6873 - zfs_destroy_snaps_nvl leaks errlist #4614

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/libzfs/libzfs_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3447,13 +3447,15 @@ int
zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
{
int ret;
nvlist_t *errlist;
nvlist_t *errlist = NULL;
nvpair_t *pair;

ret = lzc_destroy_snaps(snaps, defer, &errlist);

if (ret == 0)
if (ret == 0) {
nvlist_free(errlist);
return (0);
}

if (nvlist_empty(errlist)) {
char errbuf[1024];
Expand Down Expand Up @@ -3481,6 +3483,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
}
}

nvlist_free(errlist);
return (ret);
}

Expand Down
4 changes: 4 additions & 0 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,7 @@ spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type,
return (error);
}

#ifdef ZFS_DEBUG
/*
* Count the number of per-vdev ZAPs associated with all of the vdevs in the
* vdev tree rooted in the given vd, and ensure that each ZAP is present in the
Expand Down Expand Up @@ -2267,6 +2268,7 @@ vdev_count_verify_zaps(vdev_t *vd)

return (total);
}
#endif

/*
* Load an existing storage pool, using the pool's builtin spa_config as a
Expand Down Expand Up @@ -6714,6 +6716,7 @@ spa_sync(spa_t *spa, uint64_t txg)

} while (dmu_objset_is_dirty(mos, txg));

#ifdef ZFS_DEBUG
if (!list_is_empty(&spa->spa_config_dirty_list)) {
/*
* Make sure that the number of ZAPs for all the vdevs matches
Expand All @@ -6728,6 +6731,7 @@ spa_sync(spa_t *spa, uint64_t txg)
ASSERT3U(vdev_count_verify_zaps(spa->spa_root_vdev), ==,
all_vdev_zap_entry_count);
}
#endif

/*
* Rewrite the vdev configuration (which includes the uberblock)
Expand Down