Date: Fri, 27 Jul 2007 12:39:44 +0200 From: Ulf Lilleengen <lulf@FreeBSD.org> To: freebsd-geom@freebsd.org Cc: pjd@FreeBSD.org, phk@FreeBSD.org Subject: [PATCH] geom_bsd tasting holds topology_lock when doing I/O Message-ID: <20070727103944.GA12318@stud.ntnu.no>
next in thread | raw e-mail | index | archive | help
--envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="geom_bsd_toplock.diff" 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); --envbJBWh7q8WU6mo--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070727103944.GA12318>