diff options
author | Jiri Svoboda <Jiri.Svoboda@Sun.COM> | 2010-05-07 14:01:12 +0200 |
---|---|---|
committer | Jiri Svoboda <Jiri.Svoboda@Sun.COM> | 2010-05-07 14:01:12 +0200 |
commit | 0c034175550709323575bc82b80a835256239e86 (patch) | |
tree | 44d6b875a174e8f9305b5d817737658339787c16 /usr/src/lib/mpapi | |
parent | df86a2dd3a267e0886f15e8c921dace3bbf954a1 (diff) | |
download | illumos-gate-0c034175550709323575bc82b80a835256239e86.tar.gz |
6747445 mpathadm design breaks where more than one target driver is multi-pathed ( SAS + SAN luns )
6940594 libmpscsi_vhci returns garbage instead of iport object sequence number in event
6942152 Fix for CR 6891680 is not complete
Diffstat (limited to 'usr/src/lib/mpapi')
5 files changed, 167 insertions, 210 deletions
diff --git a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLogicalUnitProperties.c b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLogicalUnitProperties.c index 77eab9f0d4..5075f377dd 100644 --- a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLogicalUnitProperties.c +++ b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLogicalUnitProperties.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <string.h> @@ -61,14 +60,16 @@ get_devlink(di_devlink_t devlink, void *arg) { char -*getDeviceFileName(MP_UINT64 instanceNum) +*getDeviceFileName(MP_UINT64 objectSequenceNumber) { char *deviceFileName = NULL; di_node_t root_node = DI_NODE_NIL; di_node_t cur_node = DI_NODE_NIL; - MP_UINT64 nodeInstance = 0; + int instNum; + int majorNum; + MP_UINT64 osn; char *pathName = NULL; char *minorName = "c,raw"; @@ -85,8 +86,8 @@ char log(LOG_INFO, "getDeviceFileName()", " - enter"); log(LOG_INFO, "getDeviceFileName()", - " - instanceNum: %llx", - instanceNum); + " - objectSequenceNumber: %llx", + objectSequenceNumber); root_node = di_init("/", DINFOCACHE); if (DI_NODE_NIL == root_node) { @@ -112,9 +113,14 @@ char while (DI_NODE_NIL != cur_node) { - nodeInstance = (MP_UINT64)di_instance(cur_node); + instNum = di_instance(cur_node); + majorNum = di_driver_major(cur_node); - if (nodeInstance == instanceNum) { + osn = 0; + osn = MP_STORE_INST_TO_ID(instNum, osn); + osn = MP_STORE_MAJOR_TO_ID(majorNum, osn); + + if (osn == objectSequenceNumber) { log(LOG_INFO, "getDeviceFileName()", " - found node."); diff --git a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLuOidListFromTPG.c b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLuOidListFromTPG.c index bb05513cb3..8e738070ed 100644 --- a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLuOidListFromTPG.c +++ b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLuOidListFromTPG.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <errno.h> @@ -57,7 +56,7 @@ * provided by the schi_vhci driver. */ -static int checkTPGList(MP_UINT32 tpgID, int inst_num) +static int checkTPGList(MP_UINT32 tpgID, MP_UINT64 objectSequenceNumber) { int tpg = 0; int status = MP_FALSE; @@ -74,7 +73,7 @@ static int checkTPGList(MP_UINT32 tpgID, int inst_num) log(LOG_INFO, "checkTPGList()", " - enter"); - luOID.objectSequenceNumber = (MP_UINT64)inst_num; + luOID.objectSequenceNumber = objectSequenceNumber; luOID.objectType = MP_OBJECT_TYPE_MULTIPATH_LU; luOID.ownerId = g_pluginOwnerID; @@ -82,24 +81,22 @@ static int checkTPGList(MP_UINT32 tpgID, int inst_num) if (MP_STATUS_SUCCESS != mpStatus) { log(LOG_INFO, "checkTPGList()", - " - getAssociatedTPGOidList() failed: %d", - mpStatus); + " - getAssociatedTPGOidList() failed: %d", + mpStatus); return (MP_FALSE); } for (tpg = 0; tpg < ppList->oidCount; tpg++) { - mpStatus = - getTargetPortGroupProperties(ppList->oids[tpg], - &tpgProps); + mpStatus = getTargetPortGroupProperties(ppList->oids[tpg], + &tpgProps); if (MP_STATUS_SUCCESS != mpStatus) { log(LOG_INFO, "checkTPGList()", - " - getTargetPortGroupProperties()" - " failed: %d", - mpStatus); + " - getTargetPortGroupProperties() failed: %d", + mpStatus); return (MP_FALSE); } @@ -108,9 +105,8 @@ static int checkTPGList(MP_UINT32 tpgID, int inst_num) status = MP_TRUE; - log(LOG_INFO, - "checkTPGList()", - " - found a match"); + log(LOG_INFO, "checkTPGList()", + " - found a match"); break; } @@ -144,7 +140,11 @@ static int getOidList(di_node_t root_node, int tpgID, int ioctlStatus = 0; int match = 0; int status = -1; + int sv_child_inst = 0; + int sv_child_major = 0; + MP_UINT64 osn; + int hasTpgMatch = MP_FALSE; struct stat buffer; @@ -173,9 +173,7 @@ static int getOidList(di_node_t root_node, int tpgID, tpOSN = tpList->oids[tp].objectSequenceNumber; - log(LOG_INFO, "getOidList()", - "tpOSN = %llx", - tpOSN); + log(LOG_INFO, "getOidList()", "tpOSN = %llx", tpOSN); (void) memset(&mp_ioctl, 0, sizeof (mp_iocdata_t)); (void) memset(&tpInfo, 0, sizeof (mp_target_port_prop_t)); @@ -188,13 +186,13 @@ static int getOidList(di_node_t root_node, int tpgID, mp_ioctl.mp_xfer = MP_XFER_READ; log(LOG_INFO, "getOidList()", - "mp_ioctl.mp_cmd (MP_GET_TARGET_PORT_PROP) : %d", - mp_ioctl.mp_cmd); + "mp_ioctl.mp_cmd (MP_GET_TARGET_PORT_PROP) : %d", + mp_ioctl.mp_cmd); ioctlStatus = ioctl(g_scsi_vhci_fd, MP_CMD, &mp_ioctl); - log(LOG_INFO, "getOidList()", - " IOCTL call returned: %d", ioctlStatus); + log(LOG_INFO, "getOidList()", " IOCTL call returned: %d", + ioctlStatus); if (ioctlStatus < 0) { ioctlStatus = errno; @@ -202,17 +200,16 @@ static int getOidList(di_node_t root_node, int tpgID, if (ioctlStatus != 0) { log(LOG_INFO, "getOidList()", - "IOCTL call failed. IOCTL error is: %d", - ioctlStatus); + "IOCTL call failed. IOCTL error is: %d", + ioctlStatus); log(LOG_INFO, "getOidList()", - "IOCTL call failed. IOCTL error is: %s", - strerror(ioctlStatus)); + "IOCTL call failed. IOCTL error is: %s", + strerror(ioctlStatus)); log(LOG_INFO, "getOidList()", - "IOCTL call failed. mp_ioctl.mp_errno: %x", - mp_ioctl.mp_errno); + "IOCTL call failed. mp_ioctl.mp_errno: %x", + mp_ioctl.mp_errno); - log(LOG_INFO, "getOidList()", - " - error exit"); + log(LOG_INFO, "getOidList()", " - error exit"); return (-1); } @@ -220,7 +217,7 @@ static int getOidList(di_node_t root_node, int tpgID, sv_node = di_drv_first_node("scsi_vhci", root_node); if (DI_NODE_NIL == sv_node) { log(LOG_INFO, "getOidList()", - " - di_drv_first_node() failed"); + " - di_drv_first_node() failed"); return (-1); } @@ -237,17 +234,15 @@ static int getOidList(di_node_t root_node, int tpgID, (void) di_path_prop_lookup_strings(path, - "target-port", - &portName); + "target-port", &portName); if (NULL != portName) { if (0 == strncmp(portName, - tpInfo.portName, - strlen(tpInfo.portName))) { + tpInfo.portName, + strlen(tpInfo.portName))) { match = 1; - break; } } @@ -258,7 +253,7 @@ static int getOidList(di_node_t root_node, int tpgID, if (match) { log(LOG_INFO, "getOidList()", - " - got a match"); + " - got a match"); pathName = di_devfs_path(child_node); @@ -270,57 +265,57 @@ static int getOidList(di_node_t root_node, int tpgID, status = stat(fullName, &buffer); if (status < 0) { - log(LOG_INFO, - "getOidList()", - " - stat() call failed: %d", - status); + log(LOG_INFO, "getOidList()", + " - stat() call failed: %d", + status); - log(LOG_INFO, - "getOidList()", - " - errno: [%d].", errno); + log(LOG_INFO, "getOidList()", + " - errno: [%d].", errno); - log(LOG_INFO, - "getOidList()", - " - strerror(errno): [%s].", - strerror(errno)); + log(LOG_INFO, "getOidList()", + " - strerror(errno): [%s].", + strerror(errno)); - log(LOG_INFO, - "getOidList()", - " - error exit."); + log(LOG_INFO, "getOidList()", + " - error exit."); return (-1); } sv_child_inst = di_instance(child_node); + sv_child_major = di_driver_major(child_node); + + osn = 0; + osn = MP_STORE_INST_TO_ID(sv_child_inst, osn); + osn = MP_STORE_MAJOR_TO_ID(sv_child_major, + osn); /* * OK, found an portName that matches, let's * to see if the IDs match. */ - hasTpgMatch = - checkTPGList(tpgID, - sv_child_inst); + hasTpgMatch = checkTPGList(tpgID, osn); if (MP_TRUE != hasTpgMatch) { child_node = - di_sibling_node(child_node); + di_sibling_node(child_node); continue; } if (haveList && - (numNodes < pOidList->oidCount)) { + (numNodes < pOidList->oidCount)) { pOidList->oids[numNodes]. - objectSequenceNumber = - sv_child_inst; + objectSequenceNumber = + sv_child_inst; pOidList->oids[numNodes].objectType = - MP_OBJECT_TYPE_MULTIPATH_LU; + MP_OBJECT_TYPE_MULTIPATH_LU; pOidList->oids[numNodes].ownerId = - g_pluginOwnerID; + g_pluginOwnerID; } ++numNodes; @@ -330,12 +325,7 @@ static int getOidList(di_node_t root_node, int tpgID, } } - log(LOG_INFO, - "getOidList()", - " - numNodes: %d", - numNodes); - - + log(LOG_INFO, "getOidList()", " - numNodes: %d", numNodes); log(LOG_INFO, "getOidList()", " - exit"); return (numNodes); @@ -367,21 +357,18 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) MP_TARGET_PORT_GROUP_PROPERTIES sourceTpgProps; - log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", " - enter"); - - log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - "oid.objectSequenceNumber = %llx", - oid.objectSequenceNumber); + "oid.objectSequenceNumber = %llx", + oid.objectSequenceNumber); mpStatus = getTargetPortGroupProperties(oid, &sourceTpgProps); if (MP_STATUS_SUCCESS != mpStatus) { log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - " - getTargetPortGroupProperties() failed: %d", - mpStatus); + " - getTargetPortGroupProperties() failed: %d", + mpStatus); return (mpStatus); } @@ -389,17 +376,15 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) /* The TPG ID we will use as a serch key */ sourceTpgID = sourceTpgProps.tpgID; - log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - "sourceTpgID = %d", - sourceTpgID); + log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", "sourceTpgID = %d", + sourceTpgID); /* Get a list of target ports for the TPG */ mpStatus = getTargetPortOidList(oid, &tpList); if (MP_STATUS_SUCCESS != mpStatus) { log(LOG_INFO, "getOidList()", - " - getTargetPortOidList() failed: %d", - mpStatus); + " - getTargetPortOidList() failed: %d", mpStatus); return (mpStatus); } @@ -408,7 +393,7 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) root_node = di_init("/", DINFOCACHE); if (DI_NODE_NIL == root_node) { log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - " - di_init() failed"); + " - di_init() failed"); free(tpList); @@ -420,12 +405,11 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) if (numNodes < 0) { - log(LOG_INFO, - "MP_GetMPLuOidListFromTPG()", - " - unable to get OID list."); + log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", + " - unable to get OID list."); log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - " - error exit"); + " - error exit"); free(tpList); @@ -439,9 +423,8 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) pOidList = createOidList(1); if (NULL == pOidList) { - log(LOG_INFO, - "MP_GetMPLuOidListFromTPG()", - " - unable to create OID list."); + log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", + " - unable to create OID list."); free(tpList); @@ -450,16 +433,12 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) return (MP_STATUS_INSUFFICIENT_MEMORY); } - pOidList->oids[0].objectType = - MP_OBJECT_TYPE_MULTIPATH_LU; - - pOidList->oids[0].ownerId = - g_pluginOwnerID; - + pOidList->oids[0].objectType = MP_OBJECT_TYPE_MULTIPATH_LU; + pOidList->oids[0].ownerId = g_pluginOwnerID; *ppList = pOidList; log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - " - returning empty list."); + " - returning empty list."); free(tpList); @@ -469,9 +448,9 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) *ppList = createOidList(numNodes); if (NULL == *ppList) { log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - "no memory for *ppList"); + "no memory for *ppList"); log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - " - error exit"); + " - error exit"); free(tpList); @@ -487,14 +466,14 @@ MP_GetMPLuOidListFromTPG(MP_OID oid, MP_OID_LIST **ppList) for (i = 0; i < (*ppList)->oidCount; i++) { log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - "(*ppList)->oids[%d].objectType = %d", - i, (*ppList)->oids[i].objectType); + "(*ppList)->oids[%d].objectType = %d", + i, (*ppList)->oids[i].objectType); log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - "(*ppList)->oids[%d].ownerId = %d", - i, (*ppList)->oids[i].ownerId); + "(*ppList)->oids[%d].ownerId = %d", + i, (*ppList)->oids[i].ownerId); log(LOG_INFO, "MP_GetMPLuOidListFromTPG()", - "(*ppList)->oids[%d].objectSequenceNumber = %llx", - i, (*ppList)->oids[i].objectSequenceNumber); + "(*ppList)->oids[%d].objectSequenceNumber = %llx", + i, (*ppList)->oids[i].objectSequenceNumber); } free(tpList); diff --git a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusDevProd.c b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusDevProd.c index a7da4c2e07..a010779056 100644 --- a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusDevProd.c +++ b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusDevProd.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <string.h> @@ -50,7 +49,9 @@ static int getOidList(di_node_t root_node, di_node_t sv_node = DI_NODE_NIL; di_node_t sv_child_node = DI_NODE_NIL; - MP_UINT64 nodeInstance = 0; + int instNum; + int majorNum; + MP_UINT64 osn; log(LOG_INFO, "getOidList()", " - enter"); @@ -58,9 +59,7 @@ static int getOidList(di_node_t root_node, sv_node = di_drv_first_node("scsi_vhci", root_node); if (DI_NODE_NIL == sv_node) { - log(LOG_INFO, "getOidList()", - " - di_drv_first_node() failed"); - + log(LOG_INFO, "getOidList()", " - di_drv_first_node() failed"); return (-1); } @@ -69,44 +68,37 @@ static int getOidList(di_node_t root_node, while (DI_NODE_NIL != sv_child_node) { - (void) di_prop_lookup_strings(DDI_DEV_T_ANY, - sv_child_node, - "inquiry-product-id", - &pid); + (void) di_prop_lookup_strings(DDI_DEV_T_ANY, sv_child_node, + "inquiry-product-id", &pid); pidSize = strlen(pid); - (void) di_prop_lookup_strings(DDI_DEV_T_ANY, - sv_child_node, - "inquiry-vendor-id", - &vid); + (void) di_prop_lookup_strings(DDI_DEV_T_ANY, sv_child_node, + "inquiry-vendor-id", &vid); vidSize = strlen(vid); if ((0 == strncmp(pProductID, pid, pidSize)) && (0 == strncmp(pVendorID, vid, vidSize))) { - if (haveList) { + instNum = di_instance(sv_child_node); + majorNum = di_driver_major(sv_child_node); - nodeInstance = - (MP_UINT64) - di_instance(sv_child_node); + if (haveList && numNodes < pOidList->oidCount) { - if (numNodes < pOidList->oidCount) { + osn = 0; + osn = MP_STORE_INST_TO_ID(instNum, osn); + osn = MP_STORE_MAJOR_TO_ID(majorNum, osn); - pOidList->oids[numNodes]. - objectType = - MP_OBJECT_TYPE_MULTIPATH_LU; + pOidList->oids[numNodes].objectType = + MP_OBJECT_TYPE_MULTIPATH_LU; - pOidList->oids[numNodes]. - ownerId = - g_pluginOwnerID; + pOidList->oids[numNodes].ownerId = + g_pluginOwnerID; - pOidList->oids[numNodes]. - objectSequenceNumber = - nodeInstance; - } - } + pOidList->oids[numNodes].objectSequenceNumber = + osn; + } ++numNodes; } @@ -115,12 +107,7 @@ static int getOidList(di_node_t root_node, } - log(LOG_INFO, - "getOidList()", - " - numNodes: %d", - numNodes); - - + log(LOG_INFO, "getOidList()", " - numNodes: %d", numNodes); log(LOG_INFO, "getOidList()", " - exit"); return (numNodes); @@ -145,20 +132,17 @@ MP_GetMultipathLusDevProd(MP_OID oid, MP_OID_LIST **ppList) char inqVendorID[256]; - log(LOG_INFO, "MP_GetMultipathLusDevProd()", " - enter"); - - log(LOG_INFO, "MP_GetMultipathLusDevProd()", - "oid.objectSequenceNumber = %llx", - oid.objectSequenceNumber); + "oid.objectSequenceNumber = %llx", + oid.objectSequenceNumber); if (g_scsi_vhci_fd < 0) { log(LOG_INFO, "MP_GetMultipathLusDevProd()", "invalid driver file handle"); log(LOG_INFO, "MP_GetMultipathLusDevProd", - " - error exit"); + " - error exit"); return (MP_STATUS_FAILED); } @@ -175,7 +159,7 @@ MP_GetMultipathLusDevProd(MP_OID oid, MP_OID_LIST **ppList) ioctlStatus = ioctl(g_scsi_vhci_fd, MP_CMD, &mp_ioctl); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " IOCTL call returned: %d", ioctlStatus); + " IOCTL call returned: %d", ioctlStatus); if (ioctlStatus < 0) { ioctlStatus = errno; @@ -184,13 +168,13 @@ MP_GetMultipathLusDevProd(MP_OID oid, MP_OID_LIST **ppList) if (ioctlStatus != 0) { log(LOG_INFO, "MP_GetMultipathLusDevProd()", "IOCTL call failed. IOCTL error is: %d", - ioctlStatus); + ioctlStatus); log(LOG_INFO, "MP_GetMultipathLusDevProd()", "IOCTL call failed. IOCTL error is: %s", - strerror(ioctlStatus)); + strerror(ioctlStatus)); log(LOG_INFO, "MP_GetMultipathLusDevProd()", "IOCTL call failed. mp_ioctl.mp_errno: %x", - mp_ioctl.mp_errno); + mp_ioctl.mp_errno); if (ENOTSUP == ioctlStatus) { mpStatus = MP_STATUS_UNSUPPORTED; @@ -201,49 +185,40 @@ MP_GetMultipathLusDevProd(MP_OID oid, MP_OID_LIST **ppList) } log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - error exit"); + " - error exit"); return (mpStatus); } - (void) strncpy(inqProductID, - devProdInfo.prodInfo.product, - sizeof (devProdInfo.prodInfo.product)); + (void) strncpy(inqProductID, devProdInfo.prodInfo.product, + sizeof (devProdInfo.prodInfo.product)); - (void) strncpy(inqVendorID, - devProdInfo.prodInfo.vendor, - sizeof (devProdInfo.prodInfo.vendor)); + (void) strncpy(inqVendorID, devProdInfo.prodInfo.vendor, + sizeof (devProdInfo.prodInfo.vendor)); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - inqProductID: [%s]", inqProductID); + " - inqProductID: [%s]", inqProductID); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - inqVendorID: [%s]", inqVendorID); - + " - inqVendorID: [%s]", inqVendorID); root_node = di_init("/", DINFOCACHE); if (DI_NODE_NIL == root_node) { log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - di_init() failed"); + " - di_init() failed"); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - error exit"); + " - error exit"); return (MP_STATUS_FAILED); } - numNodes = getOidList(root_node, - NULL, - inqProductID, - inqVendorID); - + numNodes = getOidList(root_node, NULL, inqProductID, inqVendorID); if (numNodes < 0) { - log(LOG_INFO, - "MP_GetMultipathLusDevProd()", - " - unable to get OID list."); - log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - error exit"); + " - unable to get OID list."); + + log(LOG_INFO, "MP_GetMultipathLusDevProd()", " - error exit"); di_fini(root_node); @@ -256,26 +231,22 @@ MP_GetMultipathLusDevProd(MP_OID oid, MP_OID_LIST **ppList) *ppList = createOidList(1); if (NULL == *ppList) { - log(LOG_INFO, - "MP_GetMultipathLusDevProd()", - " - unable to create OID list."); + log(LOG_INFO, "MP_GetMultipathLusDevProd()", + " - unable to create OID list."); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - error exit"); + " - error exit"); di_fini(root_node); return (MP_STATUS_INSUFFICIENT_MEMORY); } - (*ppList)->oids[0].objectType = - MP_OBJECT_TYPE_MULTIPATH_LU; - - (*ppList)->oids[0].ownerId = - g_pluginOwnerID; + (*ppList)->oids[0].objectType = MP_OBJECT_TYPE_MULTIPATH_LU; + (*ppList)->oids[0].ownerId = g_pluginOwnerID; log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - returning empty list."); + " - returning empty list."); return (MP_STATUS_SUCCESS); } @@ -283,31 +254,27 @@ MP_GetMultipathLusDevProd(MP_OID oid, MP_OID_LIST **ppList) *ppList = createOidList(numNodes); if (NULL == *ppList) { log(LOG_INFO, "MP_GetMultipathLusDevProd()", - "no memory for *ppList"); + "no memory for *ppList"); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - " - error exit"); + " - error exit"); return (MP_STATUS_INSUFFICIENT_MEMORY); } (*ppList)->oidCount = numNodes; - numNodes = getOidList(root_node, - *ppList, - inqProductID, - inqVendorID); - + numNodes = getOidList(root_node, *ppList, inqProductID, inqVendorID); for (i = 0; i < (*ppList)->oidCount; i++) { log(LOG_INFO, "MP_GetMultipathLusDevProd()", - "(*ppList)->oids[%d].objectType = %d", - i, (*ppList)->oids[i].objectType); + "(*ppList)->oids[%d].objectType = %d", + i, (*ppList)->oids[i].objectType); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - "(*ppList)->oids[%d].ownerId = %d", - i, (*ppList)->oids[i].ownerId); + "(*ppList)->oids[%d].ownerId = %d", + i, (*ppList)->oids[i].ownerId); log(LOG_INFO, "MP_GetMultipathLusDevProd()", - "(*ppList)->oids[%d].objectSequenceNumber = %llx", - i, (*ppList)->oids[i].objectSequenceNumber); + "(*ppList)->oids[%d].objectSequenceNumber = %llx", + i, (*ppList)->oids[i].objectSequenceNumber); } 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 2f4315fb56..7f3fcf7cea 100644 --- a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c +++ b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <syslog.h> @@ -67,7 +66,9 @@ static int getOidList(di_node_t root_node, MP_OID_LIST *pOidList) { int numNodes = 0, state; - MP_UINT64 instNum = 0; + int instNum; + int majorNum; + MP_UINT64 osn; di_node_t sv_node = DI_NODE_NIL; di_node_t sv_child_node = DI_NODE_NIL; @@ -110,13 +111,17 @@ static int getOidList(di_node_t root_node, MP_OID_LIST *pOidList) } if (haveList && (numNodes < pOidList->oidCount)) { + instNum = di_instance(sv_child_node); + majorNum = di_driver_major(sv_child_node); - instNum = - (MP_UINT64)di_instance(sv_child_node); - log(LOG_INFO, "getOidList()", - " - instance number is: %llx", - instNum); + "instNum = %d", instNum); + log(LOG_INFO, "getOidList()", + "majorNum = %d", majorNum); + + osn = 0; + osn = MP_STORE_INST_TO_ID(instNum, osn); + osn = MP_STORE_MAJOR_TO_ID(majorNum, osn); pOidList->oids[numNodes].objectType = MP_OBJECT_TYPE_MULTIPATH_LU; @@ -125,7 +130,7 @@ static int getOidList(di_node_t root_node, MP_OID_LIST *pOidList) g_pluginOwnerID; pOidList->oids[numNodes].objectSequenceNumber = - instNum; + osn; } ++numNodes; diff --git a/usr/src/lib/mpapi/libmpscsi_vhci/common/mp_utils.c b/usr/src/lib/mpapi/libmpscsi_vhci/common/mp_utils.c index 6bf93829ab..e640e66391 100644 --- a/usr/src/lib/mpapi/libmpscsi_vhci/common/mp_utils.c +++ b/usr/src/lib/mpapi/libmpscsi_vhci/common/mp_utils.c @@ -437,6 +437,7 @@ notifyClient(sysevent_t *ev) valAllocated = 1; + *val = 0; *val = MP_STORE_INST_TO_ID(*instance, *val); *val = MP_STORE_MAJOR_TO_ID(*major, *val); @@ -552,7 +553,6 @@ sysevent_handler(sysevent_t *ev) /* Is the event one of ours? */ if ((strncmp(EC_SUN_MP, sysevent_get_class_name(ev), 9) != 0) && - (strncmp(EC_DEVFS, sysevent_get_class_name(ev), 8) != 0) && (strncmp(EC_DDI, sysevent_get_class_name(ev), 6) != 0)) { return; |