lvol: do not try to unload lvs until previous one is unloaded

With configuration where there are nested lvol stores we
encounter situation when hotremove and fini functions try
to unload the same lvol store second time (previous unloading
have not finished yet).

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Icb5d430d17024fbda0e6113b380d8f346a3e9a84

Reviewed-on: https://review.gerrithub.io/388790
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Maciej Szwed 2017-11-23 12:57:52 +01:00 committed by Daniel Verkamp
parent 1d6dfe6ff1
commit 0b9cfae48f

View File

@ -777,26 +777,23 @@ vbdev_lvs_init(void)
}
static void
vbdev_lvs_finished(void *cb_arg, int lvserrno)
vbdev_lvs_fini_next(void *cb_arg, int lvserrno)
{
if (TAILQ_EMPTY(&g_spdk_lvol_pairs)) {
struct lvol_store_bdev *lvs_bdev;
lvs_bdev = TAILQ_FIRST(&g_spdk_lvol_pairs);
if (lvs_bdev == NULL) {
spdk_bdev_module_finish_done();
return;
}
vbdev_lvs_unload(lvs_bdev->lvs, vbdev_lvs_fini_next, cb_arg);
}
static void
vbdev_lvs_fini(void)
{
struct lvol_store_bdev *lvs_bdev, *tmp;
if (TAILQ_EMPTY(&g_spdk_lvol_pairs)) {
spdk_bdev_module_finish_done();
return;
}
TAILQ_FOREACH_SAFE(lvs_bdev, &g_spdk_lvol_pairs, lvol_stores, tmp) {
vbdev_lvs_unload(lvs_bdev->lvs, vbdev_lvs_finished, NULL);
}
vbdev_lvs_fini_next(NULL, 0);
}
static int