From 4a22ba5be0aab1480aeac4581025ce6d7ce4b4a1 Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Mon, 28 Oct 2019 09:51:53 -0700 Subject: [PATCH] Minor spa portability fixes - FreeBSD's rootpool import code uses spa_config_parse - Move the zvol_create_minors call out from under the spa_namespace_lock in spa_import. It isn't needed and it causes a lock order reversal on FreeBSD. Reviewed-by: Igor Kozhukhov Reviewed-by: Jorgen Lundman Reviewed-by: Brian Behlendorf Signed-off-by: Matt Macy Closes #9499 --- include/sys/spa.h | 3 +++ module/zfs/spa.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/sys/spa.h b/include/sys/spa.h index 18933e0d42..3780fdae0f 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -845,6 +845,9 @@ extern void spa_config_set(spa_t *spa, nvlist_t *config); extern nvlist_t *spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats); extern void spa_config_update(spa_t *spa, int what); +extern int spa_config_parse(spa_t *spa, vdev_t **vdp, nvlist_t *nv, + vdev_t *parent, uint_t id, int atype); + /* * Miscellaneous SPA routines in spa_misc.c diff --git a/module/zfs/spa.c b/module/zfs/spa.c index facd5eda80..9bfd24d98e 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -1406,7 +1406,7 @@ spa_deactivate(spa_t *spa) * in the CLOSED state. This will prep the pool before open/creation/import. * All vdev validation is done by the vdev_alloc() routine. */ -static int +int spa_config_parse(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id, int atype) { @@ -6081,10 +6081,10 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags) spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); - zvol_create_minors(spa, pool, B_TRUE); - mutex_exit(&spa_namespace_lock); + zvol_create_minors(spa, pool, B_TRUE); + return (0); }