HomeFreeBSD

Fix user properties output for zpool list

Description

Fix user properties output for zpool list

In zpool_get_user_prop, when called from zpool_expand_proplist and
collect_pool, we often have zpool_props present in zpool_handle_t equal
to NULL. This mostly happens when only one user property is requested
using zpool list -o <user_property>. Checking for this case and
correctly initializing the zpool_props field in zpool_handle_t fixes
this issue.

Interestingly, this issue does not occur if we query any other property
like name or guid along with a user property with -o flag because while
accessing properties like guid, zpool_prop_get_int is called which
checks for this case specifically and calls zpool_get_all_props.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #16734

Details

Provenance
Umer Saleem <usaleem@ixsystems.com>Authored on Fri, Nov 8, 10:13 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Mon, Nov 11, 5:46 PM
Parents
rG3a0a142f1c41: JSON: fix user properties output for zpool list
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG1c9a4c8cb44d: Fix user properties output for zpool list (authored by Umer Saleem <usaleem@ixsystems.com>).Mon, Nov 11, 5:46 PM