Avoid the GEOM topology lock recursion when we automatically expand a pool.

The steps to reproduce the problem:

	mdconfig -a -t swap -s 3g -u 0
	gpart create -s GPT md0
	gpart add -t freebsd-zfs -s 1g md0
	zpool create -o autoexpand=on foo md0p1
	gpart resize -i 1 -s 2g md0
This commit is contained in:
pjd 2020-04-25 21:45:31 +00:00
parent c41a141aca
commit bccd2db598

View File

@ -973,18 +973,22 @@ static void
vdev_geom_close(vdev_t *vd)
{
struct g_consumer *cp;
int locked;
cp = vd->vdev_tsd;
DROP_GIANT();
g_topology_lock();
locked = g_topology_locked();
if (!locked)
g_topology_lock();
if (!vd->vdev_reopening ||
(cp != NULL && ((cp->flags & G_CF_ORPHAN) != 0 ||
(cp->provider != NULL && cp->provider->error != 0))))
vdev_geom_close_locked(vd);
g_topology_unlock();
if (!locked)
g_topology_unlock();
PICKUP_GIANT();
}