diff options
author | Tim Chase <[email protected]> | 2014-04-21 13:22:08 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-05-06 10:41:46 -0700 |
commit | 962d52421236fc9cd61d59b4f18cff3276077da9 (patch) | |
tree | 2e20ebefb0e17c7ff6df4fc797d946934c97d0c9 /module/zcommon/zprop_common.c | |
parent | 1ce0457348aeb26754ced9b575aa374fcd8dff8b (diff) |
Check the dataset type more rigorously when fetching properties.
When fetching property values of snapshots, a check against the head
dataset type must be performed. Previously, this additional check was
performed only when fetching "version", "normalize", "utf8only" or "case".
This caused the ZPL properties "acltype", "exec", "devices", "nbmand",
"setuid" and "xattr" to be erroneously displayed with meaningless values
for snapshots of volumes. It also did not allow for the display of
"volsize" of a snapshot of a volume.
This patch adds the headcheck flag paramater to zfs_prop_valid_for_type()
and zprop_valid_for_type() to indicate the check is being done
against a head dataset's type in order that properties valid only for
snapshots are handled correctly. This allows the the head check in
get_numeric_property() to be performed when fetching a property for
a snapshot.
Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2265
Diffstat (limited to 'module/zcommon/zprop_common.c')
-rw-r--r-- | module/zcommon/zprop_common.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/module/zcommon/zprop_common.c b/module/zcommon/zprop_common.c index 6d9f89a98..035f3378d 100644 --- a/module/zcommon/zprop_common.c +++ b/module/zcommon/zprop_common.c @@ -351,9 +351,13 @@ zprop_values(int prop, zfs_type_t type) /* * Returns TRUE if the property applies to any of the given dataset types. + * + * If headcheck is set, the check is being made against the head dataset + * type of a snapshot which requires to return B_TRUE when the property + * is only valid for snapshots. */ boolean_t -zprop_valid_for_type(int prop, zfs_type_t type) +zprop_valid_for_type(int prop, zfs_type_t type, boolean_t headcheck) { zprop_desc_t *prop_tbl; @@ -362,6 +366,8 @@ zprop_valid_for_type(int prop, zfs_type_t type) ASSERT(prop < zprop_get_numprops(type)); prop_tbl = zprop_get_proptable(type); + if (headcheck && prop_tbl[prop].pd_types == ZFS_TYPE_SNAPSHOT) + return (B_TRUE); return ((prop_tbl[prop].pd_types & type) != 0); } |