[Midnightbsd-cvs] src [9068] trunk/sys/cam/cam_sim.c: on SIM destruction free associated CCBs.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Oct 1 06:13:58 EDT 2016


Revision: 9068
          http://svnweb.midnightbsd.org/src/?rev=9068
Author:   laffer1
Date:     2016-10-01 06:13:58 -0400 (Sat, 01 Oct 2016)
Log Message:
-----------
on SIM destruction free associated CCBs.

Modified Paths:
--------------
    trunk/sys/cam/cam_sim.c

Modified: trunk/sys/cam/cam_sim.c
===================================================================
--- trunk/sys/cam/cam_sim.c	2016-10-01 10:13:25 UTC (rev 9067)
+++ trunk/sys/cam/cam_sim.c	2016-10-01 10:13:58 UTC (rev 9068)
@@ -40,6 +40,7 @@
 #include <cam/cam_ccb.h>
 #include <cam/cam_sim.h>
 #include <cam/cam_queue.h>
+#include <cam/cam_xpt.h>
 
 #define CAM_PATH_ANY (u_int32_t)-1
 
@@ -105,6 +106,7 @@
 void
 cam_sim_free(struct cam_sim *sim, int free_devq)
 {
+	union ccb *ccb;
 	int error;
 
 	sim->refcount--;
@@ -115,6 +117,10 @@
 
 	KASSERT(sim->refcount == 0, ("sim->refcount == 0"));
 
+	while ((ccb = (union ccb *)SLIST_FIRST(&sim->ccb_freeq)) != NULL) {
+		SLIST_REMOVE_HEAD(&sim->ccb_freeq, xpt_links.sle);
+		xpt_free_ccb(ccb);
+	}
 	if (free_devq)
 		cam_simq_free(sim->devq);
 	free(sim, M_CAMSIM);



More information about the Midnightbsd-cvs mailing list