Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2009 17:22:49 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r187028 - head/sys/cam/scsi
Message-ID:  <200901101722.n0AHMngQ004327@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sat Jan 10 17:22:49 2009
New Revision: 187028
URL: http://svn.freebsd.org/changeset/base/187028

Log:
  Don't call destroy_dev(9) with a mutex held.  While here, shuffle
  things around so the periph destructors look alike.  Based on a patch
  by Jaakko Heinonen.
  
  Submitted by:	Jaakko Heinonen
  Reviewed by:	scottl
  Approved by:	rwatson (mentor)
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/cam/scsi/scsi_ch.c
  head/sys/cam/scsi/scsi_pass.c
  head/sys/cam/scsi/scsi_pt.c
  head/sys/cam/scsi/scsi_sa.c
  head/sys/cam/scsi/scsi_ses.c
  head/sys/cam/scsi/scsi_sg.c

Modified: head/sys/cam/scsi/scsi_ch.c
==============================================================================
--- head/sys/cam/scsi/scsi_ch.c	Sat Jan 10 17:17:18 2009	(r187027)
+++ head/sys/cam/scsi/scsi_ch.c	Sat Jan 10 17:22:49 2009	(r187028)
@@ -262,9 +262,11 @@ chcleanup(struct cam_periph *periph)
 
 	softc = (struct ch_softc *)periph->softc;
 
+	xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
+	cam_periph_unlock(periph);
 	destroy_dev(softc->dev);
-	xpt_print(periph->path, "removing device entry\n");
+	cam_periph_lock(periph);
 	free(softc, M_DEVBUF);
 }
 

Modified: head/sys/cam/scsi/scsi_pass.c
==============================================================================
--- head/sys/cam/scsi/scsi_pass.c	Sat Jan 10 17:17:18 2009	(r187027)
+++ head/sys/cam/scsi/scsi_pass.c	Sat Jan 10 17:22:49 2009	(r187028)
@@ -165,13 +165,12 @@ passcleanup(struct cam_periph *periph)
 
 	softc = (struct pass_softc *)periph->softc;
 
+	if (bootverbose)
+		xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
-
+	cam_periph_unlock(periph);
 	destroy_dev(softc->dev);
-
-	if (bootverbose) {
-		xpt_print(periph->path, "removing device entry\n");
-	}
+	cam_periph_lock(periph);
 	free(softc, M_DEVBUF);
 }
 

Modified: head/sys/cam/scsi/scsi_pt.c
==============================================================================
--- head/sys/cam/scsi/scsi_pt.c	Sat Jan 10 17:17:18 2009	(r187027)
+++ head/sys/cam/scsi/scsi_pt.c	Sat Jan 10 17:22:49 2009	(r187028)
@@ -342,11 +342,11 @@ ptdtor(struct cam_periph *periph)
 
 	softc = (struct pt_softc *)periph->softc;
 
+	xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
-
+	cam_periph_unlock(periph);
 	destroy_dev(softc->dev);
-
-	xpt_print(periph->path, "removing device entry\n");
+	cam_periph_lock(periph);
 	free(softc, M_DEVBUF);
 }
 

Modified: head/sys/cam/scsi/scsi_sa.c
==============================================================================
--- head/sys/cam/scsi/scsi_sa.c	Sat Jan 10 17:17:18 2009	(r187027)
+++ head/sys/cam/scsi/scsi_sa.c	Sat Jan 10 17:22:49 2009	(r187028)
@@ -1377,17 +1377,16 @@ sacleanup(struct cam_periph *periph)
 
 	softc = (struct sa_softc *)periph->softc;
 
+	xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
-
+	cam_periph_unlock(periph);
 	destroy_dev(softc->devs.ctl_dev);
-
 	for (i = 0; i < SA_NUM_MODES; i++) {
 		destroy_dev(softc->devs.mode_devs[i].r_dev);
 		destroy_dev(softc->devs.mode_devs[i].nr_dev);
 		destroy_dev(softc->devs.mode_devs[i].er_dev);
 	}
-
-	xpt_print(periph->path, "removing device entry\n");
+	cam_periph_lock(periph);
 	free(softc, M_SCSISA);
 }
 

Modified: head/sys/cam/scsi/scsi_ses.c
==============================================================================
--- head/sys/cam/scsi/scsi_ses.c	Sat Jan 10 17:17:18 2009	(r187027)
+++ head/sys/cam/scsi/scsi_ses.c	Sat Jan 10 17:22:49 2009	(r187028)
@@ -227,9 +227,10 @@ sescleanup(struct cam_periph *periph)
 
 	softc = (struct ses_softc *)periph->softc;
 
-	destroy_dev(softc->ses_dev);
-
 	xpt_print(periph->path, "removing device entry\n");
+	cam_periph_unlock(periph);
+	destroy_dev(softc->ses_dev);
+	cam_periph_lock(periph);
 	free(softc, M_SCSISES);
 }
 

Modified: head/sys/cam/scsi/scsi_sg.c
==============================================================================
--- head/sys/cam/scsi/scsi_sg.c	Sat Jan 10 17:17:18 2009	(r187027)
+++ head/sys/cam/scsi/scsi_sg.c	Sat Jan 10 17:22:49 2009	(r187028)
@@ -200,11 +200,12 @@ sgcleanup(struct cam_periph *periph)
 	struct sg_softc *softc;
 
 	softc = (struct sg_softc *)periph->softc;
+	if (bootverbose)
+		xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
+	cam_periph_unlock(periph);
 	destroy_dev(softc->dev);
-	if (bootverbose) {
-		xpt_print(periph->path, "removing device entry\n");
-	}
+	cam_periph_lock(periph);
 	free(softc, M_DEVBUF);
 }
 



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