From a8fd4524d5d706b48fd4075f483b04ce944019b6 Mon Sep 17 00:00:00 2001 From: wuzhouhui Date: Sat, 2 Feb 2019 11:16:52 +0800 Subject: [PATCH] bdev/ftl: unlock g_ftl_bdev_lock before calls bdev_ftl_create There is no need to hold g_ftl_bdev_lock when calling bdev_ftl_create. Besides, the functions (e.g. bdev_ftl_add_ctrlr) that called by bdev_ftl_create will lock g_ftl_bdev_lock again. Change-Id: I74751822364e16c58a3065dc78f8a4dce157e925 Signed-off-by: wuzhouhui Reviewed-on: https://review.gerrithub.io/c/443066 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/bdev/ftl/bdev_ftl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/bdev/ftl/bdev_ftl.c b/lib/bdev/ftl/bdev_ftl.c index 52a64f934..cd1eb0e78 100644 --- a/lib/bdev/ftl/bdev_ftl.c +++ b/lib/bdev/ftl/bdev_ftl.c @@ -833,10 +833,9 @@ bdev_ftl_init_bdev(struct ftl_bdev_init_opts *opts, ftl_bdev_init_fn cb, void *c /* Check already attached controllers first */ LIST_FOREACH(ftl_ctrlr, &g_ftl_bdev_ctrlrs, list_entry) { if (!spdk_nvme_transport_id_compare(&ftl_ctrlr->trid, &opts->trid)) { - rc = bdev_ftl_create(ftl_ctrlr->ctrlr, &ftl_ctrlr->trid, opts->name, - &opts->range, opts->mode, &opts->uuid, cb, cb_arg); pthread_mutex_unlock(&g_ftl_bdev_lock); - return rc; + return bdev_ftl_create(ftl_ctrlr->ctrlr, &ftl_ctrlr->trid, opts->name, + &opts->range, opts->mode, &opts->uuid, cb, cb_arg); } }