[Midnightbsd-cvs] src [7990] trunk/sys/dev/isp/isp_freebsd.c: on lun disable, complete all INOTs and ATIOs with CAM_REQ_ABORTED.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Sep 15 04:28:50 EDT 2016


Revision: 7990
          http://svnweb.midnightbsd.org/src/?rev=7990
Author:   laffer1
Date:     2016-09-15 04:28:50 -0400 (Thu, 15 Sep 2016)
Log Message:
-----------
on lun disable, complete all INOTs and ATIOs with CAM_REQ_ABORTED. Obtained from FreeBSD

Modified Paths:
--------------
    trunk/sys/dev/isp/isp_freebsd.c

Modified: trunk/sys/dev/isp/isp_freebsd.c
===================================================================
--- trunk/sys/dev/isp/isp_freebsd.c	2016-09-15 08:28:00 UTC (rev 7989)
+++ trunk/sys/dev/isp/isp_freebsd.c	2016-09-15 08:28:50 UTC (rev 7990)
@@ -1154,10 +1154,27 @@
 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 @@
 	}
 	ccb->ccb_h.status = status;
 	if (status == CAM_REQ_CMP) {
+		destroy_lun_state(isp, tptr);
 		xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n");
-		destroy_lun_state(isp, tptr);
 	} else {
 		if (tptr)
 			rls_lun_statep(isp, tptr);



More information about the Midnightbsd-cvs mailing list