diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-05-01 11:36:33 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-05-01 11:36:33 +0000 |
commit | 363d63cac68cdd10faf2dc4f7b4685713a4706af (patch) | |
tree | 2623fbf36694640e6015b4570f47f217b4df8ccd /usr/src | |
parent | 54a7e5761a35624975c2f384a98b3235bf625094 (diff) | |
parent | ef9416a894c90df5d46b888dbe2908c7f00fd409 (diff) | |
download | illumos-joyent-363d63cac68cdd10faf2dc4f7b4685713a4706af.tar.gz |
[illumos-gate merge]
commit ef9416a894c90df5d46b888dbe2908c7f00fd409
12296 unix: access_mask_check() warn: bitwise AND condition is false here
commit 9f9cceb6f1158940244c35cecdbc93f9a386a4b8
12662 smbios(1M) interprets jedec IDs incorrectly
12664 fix smbios memory technology operating mode capabilities
commit f343451914d0efaf2d6fc84d8818a16246b223dc
12635 Allow for '-o feature@<feature>=disabled' on the command line
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/smbios/smbios.c | 20 | ||||
-rw-r--r-- | usr/src/cmd/zpool/zpool_main.c | 43 | ||||
-rw-r--r-- | usr/src/common/acl/acl_common.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libzfs/common/libzfs_pool.c | 5 | ||||
-rw-r--r-- | usr/src/man/man1m/zpool.1m | 15 | ||||
-rw-r--r-- | usr/src/pkg/manifests/system-test-zfstest.mf | 3 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/runfiles/omnios.run | 4 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/runfiles/openindiana.run | 4 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/runfiles/smartos.run | 4 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh | 2 | ||||
-rwxr-xr-x | usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_005_pos.ksh | 93 | ||||
-rw-r--r-- | usr/src/uts/common/sys/smbios.h | 11 |
12 files changed, 167 insertions, 41 deletions
diff --git a/usr/src/cmd/smbios/smbios.c b/usr/src/cmd/smbios/smbios.c index 1d3e14e372..9c6d058182 100644 --- a/usr/src/cmd/smbios/smbios.c +++ b/usr/src/cmd/smbios/smbios.c @@ -177,13 +177,23 @@ jedec_print(FILE *fp, const char *desc, uint_t id) const char *name; uint_t cont, vendor; - vendor = id & 0xff; - cont = (id >> 8) & 0xff; + /* + * SMBIOS encodes data in the way that the underlying memory standard + * does. In this case, the upper byte indicates the vendor that we care + * about while the lower byte indicates the number of continuations that + * are needed. libjedec indexes this based on zero (e.g. table 1 is zero + * continuations), which is how the spec encodes it. We add one so that + * we can match how the spec describes it. + */ + vendor = id >> 8; + cont = id & 0x7f; name = libjedec_vendor_string(cont, vendor); if (name == NULL) { - oprintf(fp, " %s: 0x%x\n", desc, id); + oprintf(fp, " %s: Bank: 0x%x Vendor: 0x%x\n", desc, cont + 1, + vendor); } else { - oprintf(fp, " %s: 0x%x (%s)\n", desc, id, name); + oprintf(fp, " %s: Bank: 0x%x Vendor: 0x%x (%s)\n", desc, + cont + 1, vendor, name); } } @@ -1014,7 +1024,7 @@ print_memdevice(smbios_hdl_t *shp, id_t id, FILE *fp) } if (md.smbmd_opcap_flags != 0) { - flag_printf(fp, " Operating Mode Capabilities", + flag_printf(fp, "Operating Mode Capabilities", md.smbmd_opcap_flags, sizeof (md.smbmd_opcap_flags) * NBBY, smbios_memdevice_op_capab_name, smbios_memdevice_op_capab_desc); diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c index 31ce0c7e11..cb13102874 100644 --- a/usr/src/cmd/zpool/zpool_main.c +++ b/usr/src/cmd/zpool/zpool_main.c @@ -1082,6 +1082,7 @@ errout: * '/<pool>' * -t Use the temporary name until the pool is exported. * -o Set property=value. + * -o Set feature@feature=enabled|disabled. * -d Don't automatically enable all supported pool features * (individual features can be enabled with -o). * -O Set fsproperty=value in the pool's root file system @@ -1415,22 +1416,26 @@ zpool_do_create(int argc, char **argv) /* * Hand off to libzfs. */ - if (enable_all_pool_feat) { - spa_feature_t i; - for (i = 0; i < SPA_FEATURES; i++) { - char propname[MAXPATHLEN]; - zfeature_info_t *feat = &spa_feature_table[i]; - (void) snprintf(propname, sizeof (propname), - "feature@%s", feat->fi_uname); - - /* - * Skip feature if user specified it manually - * on the command line. - */ - if (nvlist_exists(props, propname)) - continue; + spa_feature_t i; + for (i = 0; i < SPA_FEATURES; i++) { + char propname[MAXPATHLEN]; + char *propval; + zfeature_info_t *feat = &spa_feature_table[i]; + (void) snprintf(propname, sizeof (propname), + "feature@%s", feat->fi_uname); + /* + * Only features contained in props will be enabled: + * remove from the nvlist every ZFS_FEATURE_DISABLED + * value and add every missing ZFS_FEATURE_ENABLED if + * enable_all_pool_feat is set. + */ + if (!nvlist_lookup_string(props, propname, &propval)) { + if (strcmp(propval, ZFS_FEATURE_DISABLED) == 0) + (void) nvlist_remove_all(props, + propname); + } else if (enable_all_pool_feat) { ret = add_prop_list(propname, ZFS_FEATURE_ENABLED, &props, B_TRUE); if (ret != 0) @@ -3411,20 +3416,20 @@ print_iostat_labels(iostat_cbdata_t *cb, unsigned int force_column_width, /* * Utility function to print out a line of dashes like: * - * -------------------------------- ----- ----- ----- ----- ----- + * -------------------------------- ----- ----- ----- ----- ----- * * ...or a dashed named-row line like: * - * logs - - - - - + * logs - - - - - * * @cb: iostat data * * @force_column_width If non-zero, use the value as the column width. - * Otherwise use the default column widths. + * Otherwise use the default column widths. * * @name: Print a dashed named-row line starting - * with @name. Otherwise, print a regular - * dashed line. + * with @name. Otherwise, print a regular + * dashed line. */ static void print_iostat_dashes(iostat_cbdata_t *cb, unsigned int force_column_width, diff --git a/usr/src/common/acl/acl_common.c b/usr/src/common/acl/acl_common.c index 765d6cef12..3b4f9bdec8 100644 --- a/usr/src/common/acl/acl_common.c +++ b/usr/src/common/acl/acl_common.c @@ -875,8 +875,8 @@ access_mask_check(ace_t *acep, int mask_bit, int isowner) set_allow = ACL_WRITE_ATTRS_WRITER_SET_ALLOW; err_allow = ACL_WRITE_ATTRS_WRITER_ERR_ALLOW; } else { - if ((acep->a_access_mask & mask_bit) && - (acep->a_type & ACE_ACCESS_ALLOWED_ACE_TYPE)) { + if (((acep->a_access_mask & mask_bit) != 0) && + (acep->a_type == ACE_ACCESS_ALLOWED_ACE_TYPE)) { return (ENOTSUP); } return (0); diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c index aa6bf358b8..4ec383d318 100644 --- a/usr/src/lib/libzfs/common/libzfs_pool.c +++ b/usr/src/lib/libzfs/common/libzfs_pool.c @@ -474,10 +474,11 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, } (void) nvpair_value_string(elem, &strval); - if (strcmp(strval, ZFS_FEATURE_ENABLED) != 0) { + if (strcmp(strval, ZFS_FEATURE_ENABLED) != 0 && + strcmp(strval, ZFS_FEATURE_DISABLED) != 0) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "property '%s' can only be set to " - "'enabled'"), propname); + "'enabled' or 'disabled'"), propname); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); goto error; } diff --git a/usr/src/man/man1m/zpool.1m b/usr/src/man/man1m/zpool.1m index 5a793062f2..6d291ba46a 100644 --- a/usr/src/man/man1m/zpool.1m +++ b/usr/src/man/man1m/zpool.1m @@ -28,7 +28,7 @@ .\" Copyright 2020 Joyent, Inc. .\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved. .\" -.Dd August 30, 2019 +.Dd April 29, 2020 .Dt ZPOOL 1M .Os .Sh NAME @@ -61,6 +61,7 @@ .Op Fl B .Op Fl m Ar mountpoint .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... +.Oo Fl o Cm feature@ Ns Ar feature Ns = Ns Ar value Oc Ns ... .Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ... .Op Fl R Ar root .Op Fl t Ar tempname @@ -1045,6 +1046,7 @@ another host, and resuming I/O could result in pool damage. .Op Fl B .Op Fl m Ar mountpoint .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... +.Oo Fl o Cm feature@ Ns Ar feature Ns = Ns Ar value Oc Ns ... .Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ... .Op Fl R Ar root .Op Fl t Ar tempname @@ -1175,6 +1177,17 @@ Sets the given pool properties. See the .Sx Properties section for a list of valid properties that can be set. +.It Fl o Cm feature@ Ns Ar feature Ns = Ns Ar value +Sets the given pool feature. +See +.Xr zpool-features 5 +for a list of valid features that can be set. +.Pp +.Ar value +can either be +.Sy disabled +or +.Sy enabled . .It Fl O Ar file-system-property Ns = Ns Ar value Sets the given file system properties in the root file system of the pool. See the diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf index fd373bc8ca..5cd3c7b5e8 100644 --- a/usr/src/pkg/manifests/system-test-zfstest.mf +++ b/usr/src/pkg/manifests/system-test-zfstest.mf @@ -1633,6 +1633,9 @@ file \ path=opt/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg \ mode=0555 file \ + path=opt/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_005_pos \ + mode=0555 +file \ path=opt/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_tempname \ mode=0555 file \ diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run index 17107c6efc..08783b5c10 100644 --- a/usr/src/test/zfs-tests/runfiles/omnios.run +++ b/usr/src/test/zfs-tests/runfiles/omnios.run @@ -12,7 +12,7 @@ # # Copyright (c) 2013, 2017 by Delphix. All rights reserved. # Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. -# Copyright 2019 Joyent, Inc. +# Copyright 2020 Joyent, Inc. # Copyright 2019 RackTop Systems. # @@ -286,7 +286,7 @@ tests = ['zpool_create_001_pos', 'zpool_create_002_pos', 'zpool_create_encrypted', 'zpool_create_crypt_combos', 'zpool_create_features_001_pos', 'zpool_create_features_002_pos', 'zpool_create_features_003_pos', 'zpool_create_features_004_neg', - 'zpool_create_tempname', 'create-o_ashift'] + 'zpool_create_features_005_pos', 'zpool_create_tempname', 'create-o_ashift'] [/opt/zfs-tests/tests/functional/cli_root/zpool_destroy] tests = ['zpool_destroy_001_pos', 'zpool_destroy_002_pos', diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run index 2f12f5de58..6eed598509 100644 --- a/usr/src/test/zfs-tests/runfiles/openindiana.run +++ b/usr/src/test/zfs-tests/runfiles/openindiana.run @@ -12,7 +12,7 @@ # # Copyright (c) 2012, 2017 by Delphix. All rights reserved. # Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. -# Copyright 2019 Joyent, Inc. +# Copyright 2020 Joyent, Inc. # Copyright 2019 RackTop Systems. # @@ -286,7 +286,7 @@ tests = ['zpool_create_001_pos', 'zpool_create_002_pos', 'zpool_create_encrypted', 'zpool_create_crypt_combos', 'zpool_create_features_001_pos', 'zpool_create_features_002_pos', 'zpool_create_features_003_pos', 'zpool_create_features_004_neg', - 'zpool_create_tempname', 'create-o_ashift'] + 'zpool_create_features_005_pos', 'zpool_create_tempname', 'create-o_ashift'] [/opt/zfs-tests/tests/functional/cli_root/zpool_destroy] tests = ['zpool_destroy_001_pos', 'zpool_destroy_002_pos', diff --git a/usr/src/test/zfs-tests/runfiles/smartos.run b/usr/src/test/zfs-tests/runfiles/smartos.run index f8c81e5865..2379f4d81e 100644 --- a/usr/src/test/zfs-tests/runfiles/smartos.run +++ b/usr/src/test/zfs-tests/runfiles/smartos.run @@ -10,7 +10,7 @@ # # -# Copyright 2019 Joyent, Inc. +# Copyright 2020 Joyent, Inc. # [DEFAULT] @@ -242,7 +242,7 @@ tests = ['zpool_create_001_pos', 'zpool_create_002_pos', 'zpool_create_encrypted', 'zpool_create_crypt_combos', 'zpool_create_features_001_pos', 'zpool_create_features_002_pos', 'zpool_create_features_003_pos', 'zpool_create_features_004_neg', - 'zpool_create_tempname', 'create-o_ashift'] + 'zpool_create_features_005_pos', 'zpool_create_tempname', 'create-o_ashift'] [/opt/zfs-tests/tests/functional/cli_root/zpool_destroy] tests = ['zpool_destroy_001_pos', 'zpool_destroy_002_pos', diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh index 83886533c4..84af87d613 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh @@ -38,7 +38,7 @@ verify_runnable "global" properties="\ -feature@async_destroy=disabled \ +feature@async_destroy=disable \ feature@async_destroy=active \ feature@xxx_fake_xxx=enabled \ unsupported@some_feature=inactive \ diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_005_pos.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_005_pos.ksh new file mode 100755 index 0000000000..a8ed95109f --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_005_pos.ksh @@ -0,0 +1,93 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib + +################################################################################ +# +# Specifically disabling a feature, all other features should be enabled. +# +# 1. Loop through all existing features: +# a. Create a new pool with '-o feature@XXX=disabled'. +# b. Verify that every other feature is 'enabled' or 'active'. +# +################################################################################ + +verify_runnable "global" + +function cleanup +{ + datasetexists $TESTPOOL && log_must zpool destroy $TESTPOOL +} + +function check_features +{ + typeset feature="${1}" + + zpool get all ${TESTPOOL} | grep feature@ | while read line; do + set -- $(echo "${line}") + + if [[ "feature@${feature}" == "${2}" ]]; then + # Failure passed feature must be disabled. + if [[ "${3}" != "disabled" ]]; then + return 1; + fi + else + # Failure other features must be enabled or active. + if [[ "${3}" != "enabled" && "${3}" != "active" ]]; then + return 2; + fi + fi + done + + # All features enabled or active except the expected one. + return 0 +} + +log_onexit cleanup + +# Several representative features are tested to keep the test time short. +# The features 'extensible_dataset' and 'enabled_txg' are intentionally +# excluded because other features depend on them. +set -A features \ + "hole_birth" \ + "large_blocks" \ + "large_dnode" \ + "userobj_accounting" + +typeset -i i=0 +while (( $i < ${#features[*]} )); do + log_assert "'zpool create' creates pools with ${features[i]} disabled" + + log_must zpool create -f -o "feature@${features[i]}=disabled" \ + $TESTPOOL $DISKS + log_must check_features "${features[i]}" + log_must zpool destroy -f $TESTPOOL + (( i = i+1 )) +done + +log_pass "'zpool create -o feature@feature=disabled' disables features" diff --git a/usr/src/uts/common/sys/smbios.h b/usr/src/uts/common/sys/smbios.h index 34281898e0..55048d549d 100644 --- a/usr/src/uts/common/sys/smbios.h +++ b/usr/src/uts/common/sys/smbios.h @@ -1315,11 +1315,12 @@ typedef struct smbios_memdevice { #define SMB_MTECH_NVDIMM_P 0x06 /* NVDIMM-P */ #define SMB_MTECH_INTCPM 0x07 /* Intel Optane DC Persistent Memory */ -#define SMB_MOMC_OTHER 0x01 /* other */ -#define SMB_MOMC_UNKNOWN 0x02 /* unknown */ -#define SMB_MOMC_VOLATILE 0x04 /* Volatile memory */ -#define SMB_MOMC_BYTE_PM 0x08 /* Byte-accessible persistent memory */ -#define SMB_MOMC_BLOCK_PM 0x10 /* Block-accessible persistent memory */ +#define SMB_MOMC_RESERVED 0x01 /* reserved */ +#define SMB_MOMC_OTHER 0x02 /* other */ +#define SMB_MOMC_UNKNOWN 0x04 /* unknown */ +#define SMB_MOMC_VOLATILE 0x08 /* Volatile memory */ +#define SMB_MOMC_BYTE_PM 0x10 /* Byte-accessible persistent memory */ +#define SMB_MOMC_BLOCK_PM 0x20 /* Block-accessible persistent memory */ /* * SMBIOS Memory Array Mapped Address. See DSP0134 Section 7.20 for more |