PERFORCE change 116622 for review

Scott Long scottl at FreeBSD.org
Tue Mar 27 04:08:13 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=116622

Change 116622 by scottl at scottl-x64 on 2007/03/27 04:07:44

	Don't let the periph be removed while the sysctl registration task
	is still running.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#10 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#26 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#10 (text+ko) ====

@@ -572,8 +572,10 @@
 	char tmpstr[80], tmpstr2[80];
 
 	periph = (struct cam_periph *)context;
+	if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+		return;
+
 	softc = (struct cd_softc *)periph->softc;
-
 	snprintf(tmpstr, sizeof(tmpstr), "CAM CD unit %d", periph->unit_number);
 	snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number);
 
@@ -588,6 +590,7 @@
 	if (softc->sysctl_tree == NULL) {
 		printf("cdsysctlinit: unable to allocate sysctl tree\n");
 		mtx_unlock(&Giant);
+		cam_periph_release(periph);
 		return;
 	}
 
@@ -601,6 +604,7 @@
 		"Minimum CDB size");
 
 	mtx_unlock(&Giant);
+	cam_periph_release(periph);
 }
 
 /*

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#26 (text+ko) ====

@@ -1009,8 +1009,10 @@
 	char tmpstr[80], tmpstr2[80];
 
 	periph = (struct cam_periph *)context;
+	if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+		return;
+
 	softc = (struct da_softc *)periph->softc;
-
 	snprintf(tmpstr, sizeof(tmpstr), "CAM DA unit %d", periph->unit_number);
 	snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number);
 
@@ -1023,6 +1025,7 @@
 	if (softc->sysctl_tree == NULL) {
 		printf("dasysctlinit: unable to allocate sysctl tree\n");
 		mtx_unlock(&Giant);
+		cam_periph_release(periph);
 		return;
 	}
 
@@ -1036,6 +1039,7 @@
 		"Minimum CDB size");
 
 	mtx_unlock(&Giant);
+	cam_periph_release(periph);
 }
 
 static int


More information about the p4-projects mailing list