Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2012 15:32:16 +0000 (UTC)
From:      Matt Jacob <mjacob@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239330 - head/sys/dev/isp
Message-ID:  <201208161532.q7GFWGmV033243@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjacob
Date: Thu Aug 16 15:32:16 2012
New Revision: 239330
URL: http://svn.freebsd.org/changeset/base/239330

Log:
  On lun disable, complete all INOTs and ATIOs with CAM_REQ_ABORTED.
  
  Reviewed by:	ken (silently), chuck
  MFC after:	3 weeks

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==============================================================================
--- head/sys/dev/isp/isp_freebsd.c	Thu Aug 16 13:04:21 2012	(r239329)
+++ head/sys/dev/isp/isp_freebsd.c	Thu Aug 16 15:32:16 2012	(r239330)
@@ -1154,10 +1154,27 @@ create_lun_state(ispsoftc_t *isp, int bu
 static ISP_INLINE void
 destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr)
 {
+	union ccb *ccb;
 	struct tslist *lhp;
 
 	KASSERT((tptr->hold != 0), ("tptr is not held"));
 	KASSERT((tptr->hold == 1), ("tptr still held (%d)", tptr->hold));
+	do {
+		ccb = (union ccb *)SLIST_FIRST(&tptr->atios);
+		if (ccb) {
+			SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle);
+			ccb->ccb_h.status = CAM_REQ_ABORTED;
+			xpt_done(ccb);
+		}
+	} while (ccb);
+	do {
+		ccb = (union ccb *)SLIST_FIRST(&tptr->inots);
+		if (ccb) {
+			SLIST_REMOVE_HEAD(&tptr->inots, sim_links.sle);
+			ccb->ccb_h.status = CAM_REQ_ABORTED;
+			xpt_done(ccb);
+		}
+	} while (ccb);
 	ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp);
 	SLIST_REMOVE(lhp, tptr, tstate, next);
 	ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "destroyed tstate\n");
@@ -1472,8 +1489,8 @@ done:
 	}
 	ccb->ccb_h.status = status;
 	if (status == CAM_REQ_CMP) {
-		xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n");
 		destroy_lun_state(isp, tptr);
+		xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n");
 	} else {
 		if (tptr)
 			rls_lun_statep(isp, tptr);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208161532.q7GFWGmV033243>