openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.69k stars 1.76k forks source link

JSON: fix user properties output for zfs list #16732

Closed usaleem-ix closed 3 weeks ago

usaleem-ix commented 3 weeks ago

Motivation and Context

zfs list -o <user_property> does not output user properties

Description

This commit fixes JSON output for zfs list when user properties are requested with -o flag. This case needed to be handled specifically since zfs_prop_to_name does not return property name for user properties, instead it is stored in pl->pl_user_prop.

How Has This Been Tested?

Manually tested by setting the user properties and retrieving them in JSON format.

Types of changes

Checklist:

behlendorf commented 3 weeks ago

But seems like we have some problem with user properties also in zpool list -o, and not only with JSON.

I'll go ahead and merge this fix and we can resolve any other user properties issues with a new PR.