mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
spa_prop_get: require caller to supply output nvlist
All callers to spa_prop_get() and spa_prop_get_nvlist() supplied their own preallocated nvlist (except ztest), so we can remove the option to have them allocate one if none is supplied. This sidesteps a bug in spa_prop_get(), where the error var wasn't initialised, which could lead to the provided nvlist being freed at the end. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Jorgen Lundman <lundman@lundman.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16505
This commit is contained in:
+3
-2
@@ -6215,13 +6215,14 @@ void
|
||||
ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id)
|
||||
{
|
||||
(void) zd, (void) id;
|
||||
nvlist_t *props = NULL;
|
||||
|
||||
(void) pthread_rwlock_rdlock(&ztest_name_lock);
|
||||
|
||||
(void) ztest_spa_prop_set_uint64(ZPOOL_PROP_AUTOTRIM, ztest_random(2));
|
||||
|
||||
VERIFY0(spa_prop_get(ztest_spa, &props));
|
||||
nvlist_t *props = fnvlist_alloc();
|
||||
|
||||
VERIFY0(spa_prop_get(ztest_spa, props));
|
||||
|
||||
if (ztest_opts.zo_verbose >= 6)
|
||||
dump_nvlist(props, 4);
|
||||
|
||||
Reference in New Issue
Block a user