Re: atapicam panic

From: Thomas Quinot <thomas_at_FreeBSD.ORG>
Date: Tue, 16 Sep 2003 14:52:46 +0200
Le 2003-09-06, Petri Helenius écrivait :

> Should this work or is the work to port this to ATAng still undergoing?

This should work, but does not, so the work is still in progress...
 
> panic: mutex Giant not owned at ../../../dev/ata/atapi-cam.c:117

Please try this patch.

Index: atapi-cam.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/atapi-cam.c,v
retrieving revision 1.22
diff -u -r1.22 atapi-cam.c
--- atapi-cam.c	11 Sep 2003 17:34:47 -0000	1.22
+++ atapi-cam.c	16 Sep 2003 12:51:35 -0000
_at__at_ -114,13 +114,10 _at__at_
     struct cam_path *path = NULL;
     int unit;
 
-    GIANT_REQUIRED;
-
     if (mtx_initialized(&atapicam_softc_mtx) == 0)
 	mtx_init(&atapicam_softc_mtx, "ATAPI/CAM softc mutex", NULL, MTX_DEF);
 
     mtx_lock(&atapicam_softc_mtx);
-
     LIST_FOREACH(scp, &all_buses, chain) {
 	if (scp->ata_ch == ata_ch)
 	    break;
_at__at_ -130,10 +127,12 _at__at_
     if (scp != NULL)
 	return;
 
-    if ((scp = malloc(sizeof(struct atapi_xpt_softc),
-		      M_ATACAM, M_NOWAIT | M_ZERO)) == NULL)
-	goto error;
+    scp = malloc(sizeof(struct atapi_xpt_softc),
+		 M_ATACAM, M_NOWAIT | M_ZERO));
 
+    mtx_lock (&Giant);
+    if (scp == NULL)
+	goto error;
     scp->ata_ch = ata_ch;
     TAILQ_INIT(&scp->pending_hcbs);
     LIST_INSERT_HEAD(&all_buses, scp, chain);
_at__at_ -165,10 +164,12 _at__at_
 
     setup_async_cb(scp, AC_LOST_DEVICE);
     reinit_bus(scp, cold ? BOOT_ATTACH : ATTACH);
+    mtx_unlock (&Giant);
     return;
 
 error:
     free_softc(scp);
+    mtx_unlock (&Giant);
 }
 
 void

-- 
    Thomas.Quinot_at_Cuivre.FR.EU.ORG

Received on Tue Sep 16 2003 - 03:52:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:22 UTC