mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Avoid the GEOM topology lock recursion when autoexpanding 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 Authored by: pjd <pjd@FreeBSD.org> FreeBSD-commit: freebsd/freebsd@bccd2db598 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Ported-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10270
This commit is contained in:
parent
639dfeb831
commit
6f3e1a4828
@ -38,6 +38,10 @@
|
||||
#include <geom/geom_disk.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
#ifndef g_topology_locked
|
||||
#define g_topology_locked() sx_xlocked(&topology_lock)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Virtual device vector for GEOM.
|
||||
*/
|
||||
@ -800,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;
|
||||
int error, has_trim, locked;
|
||||
uint16_t rate;
|
||||
|
||||
/*
|
||||
@ -827,7 +831,9 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
|
||||
}
|
||||
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
locked = g_topology_locked();
|
||||
if (!locked)
|
||||
g_topology_lock();
|
||||
error = 0;
|
||||
|
||||
if (vd->vdev_spa->spa_is_splitting ||
|
||||
@ -922,7 +928,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
|
||||
vdev_geom_set_physpath(vd, cp, /* do_null_update */B_FALSE);
|
||||
}
|
||||
|
||||
g_topology_unlock();
|
||||
if (!locked)
|
||||
g_topology_unlock();
|
||||
PICKUP_GIANT();
|
||||
if (cp == NULL) {
|
||||
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
|
||||
|
Loading…
Reference in New Issue
Block a user