Mercurial > illumos > illumos-gate
changeset 10755:4e696bc2e825
6888439 cable pull under heavy IOPS results panics in pmcs_SAS_done()
6889343 panic in pmcs_phy_destructor, mutex_destroy: not owner
author | Jesse Butler <Jesse.Butler@Sun.COM> |
---|---|
date | Fri, 09 Oct 2009 18:07:33 -0600 |
parents | bc532f9d3ee0 |
children | 911024086aff |
files | usr/src/cmd/mdb/common/modules/pmcs/pmcs.c usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_attach.c usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c usr/src/uts/common/sys/scsi/adapters/pmcs/pmcs.h usr/src/uts/common/sys/scsi/adapters/pmcs/pmcs_def.h |
diffstat | 6 files changed, 32 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c Fri Oct 09 17:01:12 2009 -0700 +++ b/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c Fri Oct 09 18:07:33 2009 -0600 @@ -332,9 +332,9 @@ } /* - * It has to be one of new, assigned or dying to be of interest. + * It has to be new or assigned to be of interest. */ - if (xs.new == 0 && xs.assigned == 0 && xs.dying == 0) { + if (xs.new == 0 && xs.assigned == 0) { continue; } @@ -378,9 +378,8 @@ if (verbose) { if (xs.new) { mdb_printf(" new"); - } else if (xs.dying) { - mdb_printf(" dying"); - } else if (xs.assigned) { + } + if (xs.assigned) { mdb_printf(" assigned"); } if (xs.draining) {
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_attach.c Fri Oct 09 17:01:12 2009 -0700 +++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_attach.c Fri Oct 09 18:07:33 2009 -0600 @@ -1694,33 +1694,6 @@ return (B_TRUE); } - -static void -pmcs_rem_old_devices(pmcs_hw_t *pwp) -{ - pmcs_xscsi_t *xp; - int i; - - mutex_enter(&pwp->lock); - for (i = 0; i < pwp->max_dev; i++) { - xp = pwp->targets[i]; - if (xp == NULL) { - continue; - } - mutex_exit(&pwp->lock); - - mutex_enter(&xp->statlock); - if (xp->dying && (xp->dip != NULL)) { - pmcs_clear_xp(pwp, xp); - /* Target is now gone */ - } - mutex_exit(&xp->statlock); - mutex_enter(&pwp->lock); - } - mutex_exit(&pwp->lock); -} - - void pmcs_worker(void *arg) { @@ -1754,10 +1727,6 @@ pmcs_dev_state_recovery(pwp, NULL); } - if (work_flags & PMCS_WORK_FLAG_REM_DEVICES) { - pmcs_rem_old_devices(pwp); - } - if (work_flags & PMCS_WORK_FLAG_DISCOVER) { pmcs_discover(pwp); } @@ -2567,7 +2536,6 @@ tgt->new = 1; tgt->dev_gone = 0; - tgt->dying = 0; tgt->recover_wait = 0; pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, @@ -2611,11 +2579,9 @@ pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, "cancel config of vtgt %u", vtgt); } else { - xp->assigned = 0; - xp->dying = 1; - SCHEDULE_WORK(pwp, PMCS_WORK_REM_DEVICES); + pmcs_clear_xp(pwp, xp); pmcs_prt(pwp, PMCS_PRT_DEBUG_CONFIG, - "Scheduling removal of tgt 0x%p vtgt %u", + "Removed tgt 0x%p vtgt %u", (void *)xp, vtgt); } mutex_exit(&xp->statlock);
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c Fri Oct 09 17:01:12 2009 -0700 +++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c Fri Oct 09 18:07:33 2009 -0600 @@ -491,19 +491,19 @@ if (xp == NULL) { pmcs_prt(pwp, PMCS_PRT_DEBUG2, "%s: dropping due to null target", __func__); - goto dead_duck; + goto dead_target; } ASSERT(mutex_owned(&xp->statlock)); /* - * First, check to see if we're dying or unassigned. + * First, check to see if the device is gone. */ - if (xp->dying || xp->dev_gone) { + if (xp->dev_gone) { mutex_exit(&xp->statlock); pmcs_prt(pwp, PMCS_PRT_DEBUG3, - "%s: dropping due to dying/dead target 0x%p", + "%s: dropping due to dead target 0x%p", __func__, (void *)xp); - goto dead_duck; + goto dead_target; } /* @@ -556,7 +556,7 @@ return (TRAN_ACCEPT); -dead_duck: +dead_target: pkt->pkt_state = STATE_GOT_BUS; pkt->pkt_reason = CMD_DEV_GONE; mutex_enter(&pwp->cq_lock); @@ -698,7 +698,7 @@ return (0); } - if (xp->dying || xp->dev_gone) { + if (xp->dev_gone) { mutex_exit(&xp->statlock); pmcs_prt(pwp, PMCS_PRT_DEBUG, "%s: Target 0x%p has gone away", __func__, @@ -858,7 +858,7 @@ xp = lun->target; mutex_enter(&xp->statlock); - if (xp->dying || xp->dev_gone || (xp->phy == NULL)) { + if (xp->dev_gone || (xp->phy == NULL)) { mutex_exit(&xp->statlock); return (NULL); } @@ -1477,11 +1477,11 @@ } /* - * Next, check to see if the target is alive + * Next, check to see if the target is gone. */ - if (xp->dying || xp->dev_gone) { + if (xp->dev_gone) { pmcs_prt(pwp, PMCS_PRT_DEBUG, - "%s: Flushing wait queue for dying/dead tgt 0x%p", __func__, + "%s: Flushing wait queue for dead tgt 0x%p", __func__, (void *)xp); pmcs_flush_target_queues(pwp, xp, PMCS_TGT_WAIT_QUEUE); mutex_exit(&xp->statlock); @@ -1707,7 +1707,7 @@ sas_ssp_cmd_iu_t sc; mutex_enter(&xp->statlock); - if (xp->dying || !xp->assigned) { + if (!xp->assigned) { mutex_exit(&xp->statlock); return (PMCS_WQ_RUN_FAIL_OTHER); } @@ -2160,7 +2160,7 @@ pmcs_prt(pwp, PMCS_PRT_DEBUG2, "%s: regular cmd", __func__); mutex_enter(&xp->statlock); - if (xp->dying || !xp->assigned) { + if (!xp->assigned) { mutex_exit(&xp->statlock); return (PMCS_WQ_RUN_FAIL_OTHER); }
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c Fri Oct 09 17:01:12 2009 -0700 +++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c Fri Oct 09 18:07:33 2009 -0600 @@ -1639,21 +1639,8 @@ continue; } mutex_enter(&xp->statlock); - if (xp->assigned == 0 && xp->dying == 0) { - if (xp->new) { - xp->new = 0; - xp->ca = 0; - xp->qdepth = 0; - xp->phy = NULL; - } - mutex_exit(&xp->statlock); - continue; - } - xp->tagmap = 0; - xp->dying = 1; - xp->assigned = 0; + pmcs_clear_xp(pwp, xp); mutex_exit(&xp->statlock); - SCHEDULE_WORK(pwp, PMCS_WORK_REM_DEVICES); } } @@ -2895,6 +2882,7 @@ if (!IS_ROOT_PHY(pptr)) { pptr->iport = NULL; } + /* keep target */ } /* @@ -6390,29 +6378,22 @@ _NOTE(ARGUNUSED(pwp)); ASSERT(mutex_owned(&xp->statlock)); - ASSERT(xp->dying); pmcs_prt(pwp, PMCS_PRT_DEBUG, "%s: Device 0x%p is gone.", __func__, (void *)xp); /* - * Clear the dip now. This keeps pmcs_rem_old_devices from attempting + * Clear the dip now. This keeps pmcs_remove_device from attempting * to call us on the same device while we're still flushing queues. * The only side effect is we can no longer update SM-HBA properties, * but this device is going away anyway, so no matter. */ xp->dip = NULL; - /* - * Flush all target queues - */ - pmcs_flush_target_queues(pwp, xp, PMCS_TGT_ALL_QUEUES); - xp->special_running = 0; xp->recovering = 0; xp->recover_wait = 0; xp->draining = 0; - xp->dying = 0; xp->new = 0; xp->assigned = 0; xp->dev_state = 0; @@ -6423,6 +6404,11 @@ xp->wq_recovery_tail = NULL; /* Don't clear xp->phy */ /* Don't clear xp->actv_cnt */ + + /* + * Flush all target queues + */ + pmcs_flush_target_queues(pwp, xp, PMCS_TGT_ALL_QUEUES); } static int @@ -6958,7 +6944,7 @@ } tgt = pptr->target; - if (tgt == NULL) { + if (tgt == NULL || tgt->dev_gone) { if (pptr->dtype != NOTHING) { pmcs_prt(pwp, PMCS_PRT_DEBUG2, "%s: no target for DS error recovery for " @@ -6973,13 +6959,6 @@ goto next_phy; } - if (tgt->dying) { - pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE, - "%s: Not doing DS recovery on dying target %p", - __func__, (void *)tgt); - goto next_phy; - } - /* * Step 1: Put the device into the IN_RECOVERY state */ @@ -7455,7 +7434,7 @@ if (tgt != NULL) { mutex_enter(&tgt->statlock); - if (tgt->dying || !tgt->assigned) { + if (!tgt->assigned) { if (pptr) { pmcs_dec_phy_ref_count(pptr); } @@ -7466,7 +7445,7 @@ } if (pptr == NULL) { /* - * No target or dying target.Need to run RE-DISCOVERY here. + * No target, need to run RE-DISCOVERY here. */ if (pwrk->state != PMCS_WORK_STATE_TIMED_OUT) { pwrk->state = PMCS_WORK_STATE_INTR; @@ -7638,7 +7617,7 @@ mutex_exit(&pwp->lock); if (tgt != NULL) { mutex_enter(&tgt->statlock); - if (tgt->dying || !tgt->assigned) { + if (!tgt->assigned) { mutex_exit(&tgt->statlock); continue; } @@ -8011,6 +7990,7 @@ } mutex_exit(&phyp->target->statlock); } + pmcs_unlock_phy(phyp); kmem_cache_free(pwp->phy_cache, phyp); }
--- a/usr/src/uts/common/sys/scsi/adapters/pmcs/pmcs.h Fri Oct 09 17:01:12 2009 -0700 +++ b/usr/src/uts/common/sys/scsi/adapters/pmcs/pmcs.h Fri Oct 09 18:07:33 2009 -0600 @@ -98,7 +98,6 @@ recovering : 1, /* now recovering */ event_recovery : 1, /* event recovery */ draining : 1, - dying : 1, new : 1, assigned : 1, dev_gone : 1,
--- a/usr/src/uts/common/sys/scsi/adapters/pmcs/pmcs_def.h Fri Oct 09 17:01:12 2009 -0700 +++ b/usr/src/uts/common/sys/scsi/adapters/pmcs/pmcs_def.h Fri Oct 09 18:07:33 2009 -0600 @@ -234,7 +234,6 @@ * Offlevel work as a bit pattern. */ #define PMCS_WORK_DISCOVER 0 -#define PMCS_WORK_REM_DEVICES 2 #define PMCS_WORK_ABORT_HANDLE 3 #define PMCS_WORK_SPINUP_RELEASE 4 #define PMCS_WORK_SAS_HW_ACK 5 @@ -248,7 +247,6 @@ * The actual values as they appear in work_flags */ #define PMCS_WORK_FLAG_DISCOVER (1 << 0) -#define PMCS_WORK_FLAG_REM_DEVICES (1 << 2) #define PMCS_WORK_FLAG_ABORT_HANDLE (1 << 3) #define PMCS_WORK_FLAG_SPINUP_RELEASE (1 << 4) #define PMCS_WORK_FLAG_SAS_HW_ACK (1 << 5)