]> granicus.if.org Git - zfs/commitdiff
Return default value on numeric properties failing the "head check.
authorTim Chase <tim@chase2k.com>
Fri, 13 Jun 2014 12:45:08 +0000 (07:45 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 1 Jul 2014 21:14:31 +0000 (14:14 -0700)
Updates 962d52421236fc9cd61d59b4f18cff3276077da9.

The referenced fix to get_numeric_property() caused numeric property
lookups to consider the type of the parent (head) dataset when checking
validity but there are some cases in the caller expects to see the
property's default value even when the lookup is invalid.

One case in which this is true is change_one() which is part of the
renaming infrastructure.  It may look up "zoned" on a snapshot of a volume
which is not valid but it expects to see the default value of false.

There may be other, yet unidentified cases in which zfs_prop_get_int()
is used on technically invalid properties but which expect the property's
default value to be returned.

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Turbo Fredriksson <turbo@bayour.com>
Closes #2320

lib/libzfs/libzfs_dataset.c

index 5e43aab2b14d3f7a062ab228f329aab3c485884d..7cc1caaf589100abe8f6703c3225436105e4d74b 100644 (file)
@@ -1765,8 +1765,10 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
         * the property is valid for the snapshot's head dataset type.
         */
        if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT &&
-               !zfs_prop_valid_for_type(prop, zhp->zfs_head_type, B_TRUE))
+               !zfs_prop_valid_for_type(prop, zhp->zfs_head_type, B_TRUE)) {
+                       *val = zfs_prop_default_numeric(prop);
                        return (-1);
+       }
 
        switch (prop) {
        case ZFS_PROP_ATIME: