Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 2003 14:52:46 +0200
From:      Thomas Quinot <thomas@FreeBSD.ORG>
To:        Petri Helenius <pete@he.iki.fi>
Cc:        Soeren Schmidt <sos@spider.deepcore.dk>
Subject:   Re: atapicam panic
Message-ID:  <20030916125246.GC47779@melusine.cuivre.fr.eu.org>
In-Reply-To: <3F5A1AA2.9060508@he.iki.fi>
References:  <3F5A1AA2.9060508@he.iki.fi>

next in thread | previous in thread | raw e-mail | index | archive | help

--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Le 2003-09-06, Petri Helenius =E9crivait :

> 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...
=20
> panic: mutex Giant not owned at ../../../dev/ata/atapi-cam.c:117

Please try this patch.

Index: atapi-cam.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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
@@ -114,13 +114,10 @@
     struct cam_path *path =3D NULL;
     int unit;
=20
-    GIANT_REQUIRED;
-
     if (mtx_initialized(&atapicam_softc_mtx) =3D=3D 0)
 	mtx_init(&atapicam_softc_mtx, "ATAPI/CAM softc mutex", NULL, MTX_DEF);
=20
     mtx_lock(&atapicam_softc_mtx);
-
     LIST_FOREACH(scp, &all_buses, chain) {
 	if (scp->ata_ch =3D=3D ata_ch)
 	    break;
@@ -130,10 +127,12 @@
     if (scp !=3D NULL)
 	return;
=20
-    if ((scp =3D malloc(sizeof(struct atapi_xpt_softc),
-		      M_ATACAM, M_NOWAIT | M_ZERO)) =3D=3D NULL)
-	goto error;
+    scp =3D malloc(sizeof(struct atapi_xpt_softc),
+		 M_ATACAM, M_NOWAIT | M_ZERO));
=20
+    mtx_lock (&Giant);
+    if (scp =3D=3D NULL)
+	goto error;
     scp->ata_ch =3D ata_ch;
     TAILQ_INIT(&scp->pending_hcbs);
     LIST_INSERT_HEAD(&all_buses, scp, chain);
@@ -165,10 +164,12 @@
=20
     setup_async_cb(scp, AC_LOST_DEVICE);
     reinit_bus(scp, cold ? BOOT_ATTACH : ATTACH);
+    mtx_unlock (&Giant);
     return;
=20
 error:
     free_softc(scp);
+    mtx_unlock (&Giant);
 }
=20
 void

--=20
    Thomas.Quinot@Cuivre.FR.EU.ORG

--BOKacYhQ+x31HxR3
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/ZwedAE1UuDk9JGkRAlNLAJ9gGTGOi6tNgO011sKGXbr+Kgh7zwCfdhfu
Evapv/zkzcfL8f38Q+hucJ0=
=mdeZ
-----END PGP SIGNATURE-----

--BOKacYhQ+x31HxR3--



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