changeset 10901:fb88c4bfd3ae

6889372 Panic During Expander Firmware Upgrade 6892633 S7710 hotplug/removed of RCC when IO traffic is running casues system panic
author dh142964 <David.Hollister@Sun.COM>
date Wed, 28 Oct 2009 16:16:37 -0600
parents bcc724d0f0a0
children f2a954d6028e
files usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c
diffstat 2 files changed, 8 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c	Wed Oct 28 12:54:00 2009 -0600
+++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_scsa.c	Wed Oct 28 16:16:37 2009 -0600
@@ -1888,7 +1888,6 @@
 		pmcs_prt(pwp, PMCS_PRT_DEBUG,
 		    "%s: cmd 0x%p (tag 0x%x) timed out for %s",
 		    __func__, (void *)sp, pwrk->htag, pptr->path);
-		do_ds_recovery = B_TRUE;
 		goto out;
 	}
 
@@ -2029,9 +2028,6 @@
 	mutex_enter(&xp->statlock);
 	if (xp->dev_gone) {
 		mutex_exit(&xp->statlock);
-		mutex_enter(&pwp->cq_lock);
-		STAILQ_INSERT_TAIL(&pwp->cq, sp, cmd_next);
-		mutex_exit(&pwp->cq_lock);
 		pmcs_prt(pwp, PMCS_PRT_DEBUG2,
 		    "%s: Completing command for dead target 0x%p", __func__,
 		    (void *)xp);
@@ -2478,9 +2474,6 @@
 
 	if (xp->dev_gone) {
 		mutex_exit(&xp->statlock);
-		mutex_enter(&pwp->cq_lock);
-		STAILQ_INSERT_TAIL(&pwp->cq, sp, cmd_next);
-		mutex_exit(&pwp->cq_lock);
 		pmcs_prt(pwp, PMCS_PRT_DEBUG2,
 		    "%s: Completing command for dead target 0x%p", __func__,
 		    (void *)xp);
--- a/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c	Wed Oct 28 12:54:00 2009 -0600
+++ b/usr/src/uts/common/io/scsi/adapters/pmcs/pmcs_subr.c	Wed Oct 28 16:16:37 2009 -0600
@@ -2138,6 +2138,7 @@
 {
 	pmcs_phy_t		*pptr;
 	pmcs_phy_t		*root_phy;
+	boolean_t		config_changed;
 
 	DTRACE_PROBE2(pmcs__discover__entry, ulong_t, pwp->work_flags,
 	    boolean_t, pwp->config_changed);
@@ -2218,17 +2219,18 @@
 	 * SAS address or removal of target role will cause us to mark them
 	 * (and their descendents) as dead (and cause any pending commands
 	 * and associated devices to be removed).
+	 *
+	 * NOTE: We don't want to bail on discovery if the config has
+	 * changed until *after* we run pmcs_kill_devices.
 	 */
 	root_phy = pwp->root_phys;
-	if (pmcs_check_expanders(pwp, root_phy) == B_TRUE) {
-		goto out;
-	}
+	config_changed = pmcs_check_expanders(pwp, root_phy);
 
 	/*
 	 * 2. Descend the tree looking for dead devices and kill them
 	 * by aborting all active commands and then deregistering them.
 	 */
-	if (pmcs_kill_devices(pwp, root_phy)) {
+	if (pmcs_kill_devices(pwp, root_phy) || config_changed) {
 		goto out;
 	}
 
@@ -5641,7 +5643,6 @@
 	int r, result;
 	uint32_t msg[PMCS_MSG_SIZE], *ptr, status;
 	struct pmcwork *pwrk;
-	pmcs_xscsi_t *tgt;
 
 	pmcs_prt(pwp, PMCS_PRT_DEBUG, "kill %s device @ %s",
 	    pmcs_get_typename(pptr->dtype), pptr->path);
@@ -5672,19 +5673,6 @@
 		pptr->abort_pending = 0;
 	}
 
-	/*
-	 * Now that everything is aborted from the chip's perspective (or even
-	 * if it is not), flush out the wait queue.  We won't flush the active
-	 * queue since it is possible that abort completions may follow after
-	 * the notification that the abort all has completed.
-	 */
-	tgt = pptr->target;
-	if (tgt) {
-		mutex_enter(&tgt->statlock);
-		pmcs_flush_target_queues(pwp, tgt, PMCS_TGT_WAIT_QUEUE);
-		mutex_exit(&tgt->statlock);
-	}
-
 	if (pptr->valid_device_id == 0) {
 		return (0);
 	}
@@ -6975,7 +6963,8 @@
 			goto next_phy;
 		}
 
-		if (tgt->dev_state == ds) {
+		if ((tgt->dev_state == ds) &&
+		    (ds == PMCS_DEVICE_STATE_IN_RECOVERY)) {
 			pmcs_prt(pwp, PMCS_PRT_DEBUG_DEV_STATE,
 			    "%s: Target 0x%p already IN_RECOVERY", __func__,
 			    (void *)tgt);