From 962d52421236fc9cd61d59b4f18cff3276077da9 Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Mon, 21 Apr 2014 13:22:08 -0500 Subject: 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 Signed-off-by: Brian Behlendorf Closes #2265 --- cmd/zfs/zfs_iter.c | 4 ++-- cmd/zfs/zfs_main.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/zfs/zfs_iter.c b/cmd/zfs/zfs_iter.c index 8892d91f2..eb1d9a54e 100644 --- a/cmd/zfs/zfs_iter.c +++ b/cmd/zfs/zfs_iter.c @@ -328,9 +328,9 @@ zfs_sort(const void *larg, const void *rarg, void *data) rstr = rbuf; } else { lvalid = zfs_prop_valid_for_type(psc->sc_prop, - zfs_get_type(l)); + zfs_get_type(l), B_FALSE); rvalid = zfs_prop_valid_for_type(psc->sc_prop, - zfs_get_type(r)); + zfs_get_type(r), B_FALSE); if (lvalid) (void) zfs_prop_get_numeric(l, psc->sc_prop, diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index d7c1a2a47..7faab4734 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -846,7 +846,7 @@ zfs_do_create(int argc, char **argv) * if the user doesn't want the dataset automatically mounted, * then skip the mount/share step */ - if (zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT, type)) + if (zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT, type, B_FALSE)) canmount = zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT); /* @@ -1429,7 +1429,7 @@ get_callback(zfs_handle_t *zhp, void *data) if (pl->pl_all) continue; if (!zfs_prop_valid_for_type(pl->pl_prop, - ZFS_TYPE_DATASET)) { + ZFS_TYPE_DATASET, B_FALSE)) { (void) fprintf(stderr, gettext("No such property '%s'\n"), zfs_prop_to_name(pl->pl_prop)); @@ -1763,7 +1763,7 @@ inherit_recurse_cb(zfs_handle_t *zhp, void *data) * are not valid for this type of dataset. */ if (prop != ZPROP_INVAL && - !zfs_prop_valid_for_type(prop, zfs_get_type(zhp))) + !zfs_prop_valid_for_type(prop, zfs_get_type(zhp), B_FALSE)) return (0); return (zfs_prop_inherit(zhp, cb->cb_propname, cb->cb_received) != 0); -- cgit v1.2.3