aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-06-10 14:05:15 -0400
committerGitHub <[email protected]>2020-06-10 11:05:15 -0700
commitfeff3f69fc3de99f31af6955e2cb27eb8d0f436e (patch)
treed29153d24576a8522fa6a33675baf02dd19a35bf /module
parent66786f7943ee83617cbe654103aa1d2fe7e33162 (diff)
Fixup "Avoid the GEOM topology lock recursion when autoexpanding a pool"
The patch was applied to vdev_geom_open instead of vdev_geom_close by mistake. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10427
Diffstat (limited to 'module')
-rw-r--r--module/os/freebsd/zfs/vdev_geom.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/module/os/freebsd/zfs/vdev_geom.c b/module/os/freebsd/zfs/vdev_geom.c
index 0df343190..0efdb1be5 100644
--- a/module/os/freebsd/zfs/vdev_geom.c
+++ b/module/os/freebsd/zfs/vdev_geom.c
@@ -804,7 +804,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
{
struct g_provider *pp;
struct g_consumer *cp;
- int error, has_trim, locked;
+ int error, has_trim;
uint16_t rate;
/*
@@ -831,9 +831,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
}
DROP_GIANT();
- locked = g_topology_locked();
- if (!locked)
- g_topology_lock();
+ g_topology_lock();
error = 0;
if (vd->vdev_spa->spa_is_splitting ||
@@ -928,8 +926,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
vdev_geom_set_physpath(vd, cp, /* do_null_update */B_FALSE);
}
- if (!locked)
- g_topology_unlock();
+ g_topology_unlock();
PICKUP_GIANT();
if (cp == NULL) {
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
@@ -983,18 +980,22 @@ static void
vdev_geom_close(vdev_t *vd)
{
struct g_consumer *cp;
+ boolean_t 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();
}