PERFORCE change 193136 for review

Matt Jacob mjacob at FreeBSD.org
Sat May 14 17:40:52 UTC 2011


http://p4web.freebsd.org/@@193136?ac=10

Change 193136 by mjacob at mjacob-sandbox on 2011/05/14 17:39:58

	Sync up mpt2sas

Affected files ...

.. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#5 edit
.. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#5 edit

Differences ...

==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#5 (text+ko) ====

@@ -1068,18 +1068,21 @@
 	if (dp->AttachedDevHandle == 0) {
 		return (0);
 	}
+	if (dp->state == DRAINING) {
+		mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: handle 0x%x already draining\n", __func__, hdl);
+		return (0);
+	}
 	KASSERT(hdl == dp->AttachedDevHandle, ("%s: oops2", __func__));
 	if (dp->internal_tm_bsy) {
 		mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: internal task management busy for handle 0x%x- retrying\n", __func__, hdl);
 		return (EBUSY);
 	}
-	nreq = dp->active;
 	req = mpt2sas_get_request(mpt);
 	if (req == NULL) {
 		mpt2sas_prt(mpt, MP2PRT_ERR, "%s: cannot allocate request\n", __func__);
 		return (ENOBUFS);
 	}
-	dp->destroy_needed = 1;
+	dp->state = DRAINING;
 	req->flags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
 	reset = MPT2_REQ2RQS(mpt, req);
 	memset(reset, 0,  sizeof (MPI2_SCSI_TASK_MANAGE_REQUEST));
@@ -1088,12 +1091,15 @@
 	reset->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
 	mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: sending target reset for handle 0x%x\n", __func__, hdl);
 	mpt2sas_send_cmd(mpt, req);
+	nreq = dp->active;
 	error = mpt2sas_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE, 10000);
 	MPT2SAS_SYNC_ERR_NORET(mpt, error);
 	mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: %d requests were still in play at reset target reset time, %s mpt2sas_destroy_dev_part2\n", __func__, nreq,
-		(nreq == 0 && dp->destroy_needed)? "calling" : "*not* calling");
-	if (nreq == 0 && dp->destroy_needed) {
+		dp->active? "calling" : "*not* calling");
+	if (dp->active == 0) {
 		mpt2sas_destroy_dev_part2(dp);
+	} else {
+		dp->destroy_needed = 1;
 	}
 	return (0);
 }

==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#5 (text+ko) ====

@@ -362,7 +362,7 @@
 		set_qfull 	: 1;
 	uint16_t	active;
 	uint16_t	qdepth;
-	enum { NIL, NEW, ATTACHING, VALIDATING, VALIDATING_DONE, STABLE, FAILED, DETACHING } state;
+	enum { NIL, NEW, ATTACHING, VALIDATING, VALIDATING_DONE, STABLE, FAILED, DRAINING, DETACHING } state;
 };
 #define	ClearSasDev(x)				\
 	(x)->AttachedDevHandle = 0;		\


More information about the p4-projects mailing list