From 4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6 Mon Sep 17 00:00:00 2001 From: dh142964 Date: Wed, 30 Sep 2009 13:40:27 -0600 Subject: PSARC 2008/672 thebe SAS/SATA driver PSARC 2008/755 ddi_ssoft_state(9F) and ddi_isoft_state(9F) PSARC 2008/764 Cfgadm SCSI-Plugin MPxIO Support PSARC 2009/125 scsi_device property interfaces 6726110 pmcs driver (driver for thebe) 6726867 SCSAv3 --- .../common/MP_GetMultipathLusPlugin.c | 50 ++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) (limited to 'usr/src/lib/mpapi') diff --git a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c index b15a807dfa..2f4315fb56 100644 --- a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c +++ b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c @@ -32,9 +32,40 @@ #include +/* + * Checks whether there is online path or not. + * - no path found returns -1. + * - online/standby path found returns 1. + * - path exists but no online/standby path found returns 0. + */ +static int checkAvailablePath(di_node_t node) +{ + di_path_t path; + di_path_state_t state; + + if ((path = di_path_client_next_path(node, DI_PATH_NIL)) + == DI_PATH_NIL) { + log(LOG_INFO, "checkAvailalblePath()", + " - No path found"); + return (-1); + } + + do { + /* ignore the path that is neither online nor standby. */ + if (((state = di_path_state(path)) == DI_PATH_STATE_ONLINE) || + (state == DI_PATH_STATE_STANDBY)) { + return (1); + } + } while ((path = di_path_client_next_path(node, path)) != DI_PATH_NIL); + + /* return 0 for the case that there is no online path to the node. */ + log(LOG_INFO, "checkAvailalblePath()", " - No online path found"); + return (0); +} + static int getOidList(di_node_t root_node, MP_OID_LIST *pOidList) { - int numNodes = 0; + int numNodes = 0, state; MP_UINT64 instNum = 0; @@ -59,8 +90,21 @@ static int getOidList(di_node_t root_node, MP_OID_LIST *pOidList) while (DI_NODE_NIL != sv_child_node) { - /* Skip the node which is not online. */ - if (di_state(sv_child_node) != 0) { + /* skip the node which is offline, down or detached. */ + state = di_state(sv_child_node); + if ((state & DI_DEVICE_DOWN) || + (state & DI_DEVICE_OFFLINE)) { + sv_child_node = di_sibling_node(sv_child_node); + continue; + } + + /* + * skip if the node doesn't have any path avaialble. + * If any path is found from the DINFOCACHE snaphost + * that means the driver keeps track of the path regadless + * of state. + */ + if (checkAvailablePath(sv_child_node) == -1) { sv_child_node = di_sibling_node(sv_child_node); continue; } -- cgit v1.2.3