summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/lib/libzfs/common/libzfs_pool.c19
-rw-r--r--usr/src/uts/common/io/cxgbe/t4nex/t4_nexus.c4
-rw-r--r--usr/src/uts/common/io/i40e/i40e_gld.c10
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],