diff options
author | Dan McDonald <danmcd@joyent.com> | 2022-03-29 10:17:26 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2022-03-29 10:17:26 -0400 |
commit | 32bb949b910b504c06c2385bfe84e5a566d1f834 (patch) | |
tree | 78030851a4059fd744ce0148c9144fcd58946f3a | |
parent | 12fa8af70990ef789daeb78fc28e092855d90867 (diff) | |
parent | 6158afa44672def05b584840435f36f75f5a291f (diff) | |
download | illumos-joyent-32bb949b910b504c06c2385bfe84e5a566d1f834.tar.gz |
[illumos-gate merge]
commit 6158afa44672def05b584840435f36f75f5a291f
14597 i40e debug code prints MAC addresses oddly
commit 7d6cab3f0d6a4cea17d062d3a93e223b15de705c
14593 zpool online -e hangs forever after 14022
commit fe07c600e1e51d75e87d45aef001e9d6131ecdb8
14570 t4nex uses the wrong DDI register attributes
-rw-r--r-- | usr/src/lib/libzfs/common/libzfs_pool.c | 19 | ||||
-rw-r--r-- | usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c | 4 | ||||
-rw-r--r-- | usr/src/uts/common/io/i40e/i40e_gld.c | 10 |
3 files changed, 23 insertions, 10 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c index 70bdf9ad18..bb04be87e1 100644 --- a/usr/src/lib/libzfs/common/libzfs_pool.c +++ b/usr/src/lib/libzfs/common/libzfs_pool.c @@ -44,6 +44,8 @@ #include <sys/efi_partition.h> #include <sys/vtoc.h> #include <sys/zfs_ioctl.h> +#include <sys/modctl.h> +#include <sys/mkdev.h> #include <dlfcn.h> #include <libzutil.h> @@ -2803,9 +2805,11 @@ static int zpool_relabel_disk(libzfs_handle_t *hdl, const char *name, const char *msg) { char path[MAXPATHLEN]; - enum dkio_state st; int fd, error; int (*_efi_use_whole_disk)(int); + char drv[MODMAXNAMELEN]; + major_t maj; + struct stat st; if ((_efi_use_whole_disk = (int (*)(int))dlsym(RTLD_DEFAULT, "efi_use_whole_disk")) == NULL) @@ -2838,9 +2842,18 @@ zpool_relabel_disk(libzfs_handle_t *hdl, const char *name, const char *msg) * it to be checked by querying the device state, otherwise the * subsequent vdev_reopen() will very likely fail to read the device * size, faulting the pool. + * + * The dkio(4I) ioctls are implemented by the disk driver rather than + * some generic framework, so we limit its use here to drivers with + * which it has been tested. */ - st = DKIO_NONE; - (void) ioctl(fd, DKIOCSTATE, (caddr_t)&st); + if (fstat(fd, &st) == 0 && + (maj = major(st.st_rdev)) != (major_t)NODEV && + modctl(MODGETNAME, drv, sizeof (drv), &maj) == 0 && + (strcmp(drv, "blkdev") == 0 || strcmp(drv, "sd") == 0)) { + enum dkio_state dkst = DKIO_NONE; + (void) ioctl(fd, DKIOCSTATE, &dkst); + } (void) close(fd); diff --git a/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c b/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c index 9180de2392..baaa3a29d0 100644 --- a/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c +++ b/usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c @@ -313,12 +313,12 @@ t4_devo_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) ddi_device_acc_attr_t da = { .devacc_attr_version = DDI_DEVICE_ATTR_V0, .devacc_attr_endian_flags = DDI_STRUCTURE_LE_ACC, - .devacc_attr_dataorder = DDI_UNORDERED_OK_ACC + .devacc_attr_dataorder = DDI_STRICTORDER_ACC }; ddi_device_acc_attr_t da1 = { .devacc_attr_version = DDI_DEVICE_ATTR_V0, .devacc_attr_endian_flags = DDI_STRUCTURE_LE_ACC, - .devacc_attr_dataorder = DDI_MERGING_OK_ACC + .devacc_attr_dataorder = DDI_STRICTORDER_ACC }; if (cmd != DDI_ATTACH) diff --git a/usr/src/uts/common/io/i40e/i40e_gld.c b/usr/src/uts/common/io/i40e/i40e_gld.c index 5e4bee98f9..e1be82581a 100644 --- a/usr/src/uts/common/io/i40e/i40e_gld.c +++ b/usr/src/uts/common/io/i40e/i40e_gld.c @@ -11,7 +11,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2022 Joyent, Inc. * Copyright 2017 Tegile Systems, Inc. All rights reserved. * Copyright 2020 Ryan Zezeski * Copyright 2020 RackTop Systems, Inc. @@ -81,7 +81,7 @@ i40e_group_remove_mac(void *arg, const uint8_t *mac_addr) if (i40e_aq_remove_macvlan(hw, iua->iua_vsi, &filt, 1, NULL) != I40E_SUCCESS) { i40e_error(i40e, "failed to remove mac address " - "%2x:%2x:%2x:%2x:%2x:%2x from unicast filter: %d", + "%02x:%02x:%02x:%02x:%02x:%02x from unicast filter: %d", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5], filt.error_code); ret = EIO; @@ -149,7 +149,7 @@ i40e_group_add_mac(void *arg, const uint8_t *mac_addr) if ((ret = i40e_aq_add_macvlan(hw, rxg->irg_vsi_seid, &filt, 1, NULL)) != I40E_SUCCESS) { i40e_error(i40e, "failed to add mac address " - "%2x:%2x:%2x:%2x:%2x:%2x to unicast filter: %d", + "%02x:%02x:%02x:%02x:%02x:%02x to unicast filter: %d", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5], ret); ret = EIO; @@ -316,7 +316,7 @@ i40e_multicast_add(i40e_t *i40e, const uint8_t *multicast_address) if ((ret = i40e_aq_add_macvlan(hw, I40E_DEF_VSI_SEID(i40e), &filt, 1, NULL)) != I40E_SUCCESS) { i40e_error(i40e, "failed to add mac address " - "%2x:%2x:%2x:%2x:%2x:%2x to multicast filter: %d", + "%02x:%02x:%02x:%02x:%02x:%02x to multicast filter: %d", multicast_address[0], multicast_address[1], multicast_address[2], multicast_address[3], multicast_address[4], multicast_address[5], @@ -357,7 +357,7 @@ i40e_multicast_remove(i40e_t *i40e, const uint8_t *multicast_address) if (i40e_aq_remove_macvlan(hw, I40E_DEF_VSI_SEID(i40e), &filt, 1, NULL) != I40E_SUCCESS) { i40e_error(i40e, "failed to remove mac address " - "%2x:%2x:%2x:%2x:%2x:%2x from multicast " + "%02x:%02x:%02x:%02x:%02x:%02x from multicast " "filter: %d", multicast_address[0], multicast_address[1], multicast_address[2], multicast_address[3], |