[Midnightbsd-cvs] src [8806] trunk/sys/cam/scsi/scsi_enc.c: Work around a race condition in devfs by changing the way closes are handled in CAM drivers that arent part of GEOM disk classes.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 25 23:31:35 EDT 2016


Revision: 8806
          http://svnweb.midnightbsd.org/src/?rev=8806
Author:   laffer1
Date:     2016-09-25 23:31:35 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
Work around a race condition in devfs by changing the way closes are handled in CAM drivers that arent part of GEOM disk classes.

Modified Paths:
--------------
    trunk/sys/cam/scsi/scsi_enc.c

Modified: trunk/sys/cam/scsi/scsi_enc.c
===================================================================
--- trunk/sys/cam/scsi/scsi_enc.c	2016-09-26 03:30:23 UTC (rev 8805)
+++ trunk/sys/cam/scsi/scsi_enc.c	2016-09-26 03:31:35 UTC (rev 8806)
@@ -88,7 +88,7 @@
 	.d_close =	enc_close,
 	.d_ioctl =	enc_ioctl,
 	.d_name =	"ses",
-	.d_flags =	0,
+	.d_flags =	D_TRACKCLOSE,
 };
 
 static void
@@ -249,12 +249,12 @@
 		error = ENXIO;
 		goto out;
 	}
+out:
+	if (error != 0)
+		cam_periph_release_locked(periph);
 
-out:
 	cam_periph_unlock(periph);
-	if (error) {
-		cam_periph_release(periph);
-	}
+
 	return (error);
 }
 
@@ -262,17 +262,11 @@
 enc_close(struct cdev *dev, int flag, int fmt, struct thread *td)
 {
 	struct cam_periph *periph;
-	struct enc_softc *softc;
 
 	periph = (struct cam_periph *)dev->si_drv1;
 	if (periph == NULL)
 		return (ENXIO);
 
-	cam_periph_lock(periph);
-
-	softc = (struct enc_softc *)periph->softc;
-
-	cam_periph_unlock(periph);
 	cam_periph_release(periph);
 
 	return (0);



More information about the Midnightbsd-cvs mailing list