[PATCH] geom_bsd tasting holds topology_lock when doing I/O
Ulf Lilleengen
lulf at FreeBSD.org
Fri Jul 27 11:06:08 UTC 2007
Hi,
I started having problems with gvinum hanging itself up because it was waiting
for the topology lock. At the same time geom_bsd was trying to taste the new
gvinum provider that I created. This resulted in a deadlock where gvinum waited
for the lock and g_bsd_taste waited for gvinum to finish a read BIO.
The patch also asserts that the lock is not held in g_bsd_taste
--
Ulf Lilleengen
-------------- next part --------------
Index: sys/geom/geom_bsd.c
===================================================================
RCS file: /home/ncvs/src/sys/geom/geom_bsd.c,v
retrieving revision 1.78
diff -u -r1.78 geom_bsd.c
--- sys/geom/geom_bsd.c 24 May 2006 11:02:32 -0000 1.78
+++ sys/geom/geom_bsd.c 27 Jul 2007 10:34:49 -0000
@@ -201,6 +201,8 @@
struct disklabel *dl;
off_t secoff;
+ g_topology_assert_not();
+
/*
* We need to read entire aligned sectors, and we assume that the
* disklabel does not span sectors, so one sector is enough.
@@ -502,6 +504,7 @@
* using a simple "break". This improves code clarity without
* ending up in deep nesting and without using goto or come from.
*/
+ g_topology_unlock();
do {
/*
* If the provider is an MBR we will only auto attach
@@ -571,8 +574,11 @@
* Process the found disklabel, and modify our "slice"
* instance to match it, if possible.
*/
+ g_topology_lock();
error = g_bsd_modify(gp, ms->label);
+ g_topology_unlock();
} while (0);
+ g_topology_lock();
/* Success or failure, we can close our provider now. */
g_access(cp, -1, 0, 0);
More information about the freebsd-geom
mailing list