Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Mar 2007 04:08:12 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 116622 for review
Message-ID:  <200703270408.l2R48CBK015495@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=116622

Change 116622 by scottl@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



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