Print this page
9702 HBA drivers don't need the redundant devfs_clean step
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>

*** 100,111 **** #include <sys/scsi/adapters/mpt_sas/mptsas_ioctl.h> #include <sys/scsi/adapters/mpt_sas/mptsas_smhba.h> #include <sys/scsi/adapters/mpt_sas/mptsas_hash.h> #include <sys/raidioctl.h> - #include <sys/fs/dv_node.h> /* devfs_clean */ - /* * FMA header files */ #include <sys/ddifm.h> #include <sys/fm/protocol.h> --- 100,109 ----
*** 395,411 **** char *guid, dev_info_t **dip, mdi_pathinfo_t **pip, mptsas_target_t *ptgt, int lun); static void mptsas_offline_missed_luns(dev_info_t *pdip, uint16_t *repluns, int lun_cnt, mptsas_target_t *ptgt); ! static int mptsas_offline_lun(dev_info_t *pdip, dev_info_t *rdip, ! mdi_pathinfo_t *rpip, uint_t flags); static int mptsas_config_smp(dev_info_t *pdip, uint64_t sas_wwn, dev_info_t **smp_dip); ! static int mptsas_offline_smp(dev_info_t *pdip, mptsas_smp_t *smp_node, ! uint_t flags); static int mptsas_event_query(mptsas_t *mpt, mptsas_event_query_t *data, int mode, int *rval); static int mptsas_event_enable(mptsas_t *mpt, mptsas_event_enable_t *data, int mode, int *rval); --- 393,407 ---- char *guid, dev_info_t **dip, mdi_pathinfo_t **pip, mptsas_target_t *ptgt, int lun); static void mptsas_offline_missed_luns(dev_info_t *pdip, uint16_t *repluns, int lun_cnt, mptsas_target_t *ptgt); ! static int mptsas_offline_lun(dev_info_t *rdip, mdi_pathinfo_t *rpip); static int mptsas_config_smp(dev_info_t *pdip, uint64_t sas_wwn, dev_info_t **smp_dip); ! static int mptsas_offline_smp(dev_info_t *pdip, mptsas_smp_t *smp_node); static int mptsas_event_query(mptsas_t *mpt, mptsas_event_query_t *data, int mode, int *rval); static int mptsas_event_enable(mptsas_t *mpt, mptsas_event_enable_t *data, int mode, int *rval);
*** 6889,6899 **** * successfully. */ mutex_exit(&mpt->m_mutex); ndi_devi_enter(parent, &circ1); ! rval = mptsas_offline_smp(parent, psmp, NDI_DEVI_REMOVE); ndi_devi_exit(parent, circ1); dev_info = psmp->m_deviceinfo; if ((dev_info & DEVINFO_DIRECT_ATTACHED) == DEVINFO_DIRECT_ATTACHED) { --- 6885,6895 ---- * successfully. */ mutex_exit(&mpt->m_mutex); ndi_devi_enter(parent, &circ1); ! rval = mptsas_offline_smp(parent, psmp); ndi_devi_exit(parent, circ1); dev_info = psmp->m_deviceinfo; if ((dev_info & DEVINFO_DIRECT_ATTACHED) == DEVINFO_DIRECT_ATTACHED) {
*** 14691,14702 **** } if (find == 0) { /* * The lun has not been there already */ ! (void) mptsas_offline_lun(pdip, savechild, NULL, ! NDI_DEVI_REMOVE); } } pip = mdi_get_next_client_path(pdip, NULL); while (pip) { --- 14687,14697 ---- } if (find == 0) { /* * The lun has not been there already */ ! (void) mptsas_offline_lun(savechild, NULL); } } pip = mdi_get_next_client_path(pdip, NULL); while (pip) {
*** 14728,14739 **** if (find == 0) { /* * The lun has not been there already */ ! (void) mptsas_offline_lun(pdip, NULL, savepip, ! NDI_DEVI_REMOVE); } } } /* --- 14723,14733 ---- if (find == 0) { /* * The lun has not been there already */ ! (void) mptsas_offline_lun(NULL, savepip); } } } /*
*** 15023,15034 **** if (strncmp(addr, name, s) != 0) { continue; } ! tmp_rval = mptsas_offline_lun(pdip, prechild, NULL, ! NDI_DEVI_REMOVE); if (tmp_rval != DDI_SUCCESS) { rval = DDI_FAILURE; if (ndi_prop_create_boolean(DDI_DEV_T_NONE, prechild, MPTSAS_DEV_GONE) != DDI_PROP_SUCCESS) { --- 15017,15027 ---- if (strncmp(addr, name, s) != 0) { continue; } ! tmp_rval = mptsas_offline_lun(prechild, NULL); if (tmp_rval != DDI_SUCCESS) { rval = DDI_FAILURE; if (ndi_prop_create_boolean(DDI_DEV_T_NONE, prechild, MPTSAS_DEV_GONE) != DDI_PROP_SUCCESS) {
*** 15056,15067 **** if (strncmp(addr, name, s) != 0) { continue; } ! (void) mptsas_offline_lun(pdip, NULL, savepip, ! NDI_DEVI_REMOVE); /* * driver will not invoke mdi_pi_free, so path will not * be freed forever, return DDI_FAILURE. */ rval = DDI_FAILURE; --- 15049,15059 ---- if (strncmp(addr, name, s) != 0) { continue; } ! (void) mptsas_offline_lun(NULL, savepip); /* * driver will not invoke mdi_pi_free, so path will not * be freed forever, return DDI_FAILURE. */ rval = DDI_FAILURE;
*** 15068,15119 **** } return (rval); } static int ! mptsas_offline_lun(dev_info_t *pdip, dev_info_t *rdip, ! mdi_pathinfo_t *rpip, uint_t flags) { int rval = DDI_FAILURE; - char *devname; - dev_info_t *cdip, *parent; if (rpip != NULL) { - parent = scsi_vhci_dip; - cdip = mdi_pi_get_client(rpip); - } else if (rdip != NULL) { - parent = pdip; - cdip = rdip; - } else { - return (DDI_FAILURE); - } - - /* - * Make sure node is attached otherwise - * it won't have related cache nodes to - * clean up. i_ddi_devi_attached is - * similiar to i_ddi_node_state(cdip) >= - * DS_ATTACHED. - */ - if (i_ddi_devi_attached(cdip)) { - - /* Get full devname */ - devname = kmem_alloc(MAXNAMELEN + 1, KM_SLEEP); - (void) ddi_deviname(cdip, devname); - /* Clean cache */ - (void) devfs_clean(parent, devname + 1, - DV_CLEAN_FORCE); - kmem_free(devname, MAXNAMELEN + 1); - } - if (rpip != NULL) { if (MDI_PI_IS_OFFLINE(rpip)) { rval = DDI_SUCCESS; } else { rval = mdi_pi_offline(rpip, 0); } ! } else { ! rval = ndi_devi_offline(cdip, flags); } return (rval); } --- 15060,15082 ---- } return (rval); } static int ! mptsas_offline_lun(dev_info_t *rdip, mdi_pathinfo_t *rpip) { int rval = DDI_FAILURE; if (rpip != NULL) { if (MDI_PI_IS_OFFLINE(rpip)) { rval = DDI_SUCCESS; } else { rval = mdi_pi_offline(rpip, 0); } ! } else if (rdip != NULL) { ! rval = ndi_devi_offline(rdip, ! NDI_DEVFS_CLEAN | NDI_DEVI_REMOVE); } return (rval); }
*** 15141,15184 **** } return (child); } static int ! mptsas_offline_smp(dev_info_t *pdip, mptsas_smp_t *smp_node, uint_t flags) { int rval = DDI_FAILURE; - char *devname; char wwn_str[MPTSAS_WWN_STRLEN]; dev_info_t *cdip; (void) sprintf(wwn_str, "%"PRIx64, smp_node->m_addr.mta_wwn); cdip = mptsas_find_smp_child(pdip, wwn_str); - if (cdip == NULL) return (DDI_SUCCESS); ! /* ! * Make sure node is attached otherwise ! * it won't have related cache nodes to ! * clean up. i_ddi_devi_attached is ! * similiar to i_ddi_node_state(cdip) >= ! * DS_ATTACHED. ! */ ! if (i_ddi_devi_attached(cdip)) { - /* Get full devname */ - devname = kmem_alloc(MAXNAMELEN + 1, KM_SLEEP); - (void) ddi_deviname(cdip, devname); - /* Clean cache */ - (void) devfs_clean(pdip, devname + 1, - DV_CLEAN_FORCE); - kmem_free(devname, MAXNAMELEN + 1); - } - - rval = ndi_devi_offline(cdip, flags); - return (rval); } static dev_info_t * mptsas_find_child(dev_info_t *pdip, char *name) --- 15104,15127 ---- } return (child); } static int ! mptsas_offline_smp(dev_info_t *pdip, mptsas_smp_t *smp_node) { int rval = DDI_FAILURE; char wwn_str[MPTSAS_WWN_STRLEN]; dev_info_t *cdip; (void) sprintf(wwn_str, "%"PRIx64, smp_node->m_addr.mta_wwn); cdip = mptsas_find_smp_child(pdip, wwn_str); if (cdip == NULL) return (DDI_SUCCESS); ! rval = ndi_devi_offline(cdip, NDI_DEVFS_CLEAN | NDI_DEVI_REMOVE); return (rval); } static dev_info_t * mptsas_find_child(dev_info_t *pdip, char *name)