split: close descriptor and release bdev module when freeing split base

This was probably overlooked in patch be9a3b9f.

Fixes: be9a3b9f6955 ("bdev: pass descriptors for I/O operations")

Change-Id: If29ad65ac168f3dbf7e1602f26f939dfbf17599a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/370180
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-07-18 20:13:41 +02:00 committed by Daniel Verkamp
parent 1153b8c5c4
commit 02a4d6cb41

View File

@ -153,11 +153,21 @@ vbdev_split_base_get_ref(struct split_base *split_base, struct split_disk *split
split_disk->split_base = split_base;
}
static void
vbdev_split_base_free(struct split_base *split_base)
{
assert(split_base->base_bdev);
assert(split_base->desc);
spdk_bdev_module_release_bdev(split_base->base_bdev);
spdk_bdev_close(split_base->desc);
free(split_base);
}
static void
vbdev_split_base_put_ref(struct split_base *split_base)
{
if (__sync_sub_and_fetch(&split_base->ref, 1) == 0) {
free(split_base);
vbdev_split_base_free(split_base);
}
}
@ -346,9 +356,7 @@ vbdev_split_create(struct spdk_bdev *base_bdev, uint64_t split_count, uint64_t s
cleanup:
if (split_base->ref == 0) {
/* If no split_disk instances were created, free the resources */
spdk_bdev_module_release_bdev(split_base->base_bdev);
spdk_bdev_close(split_base->desc);
free(split_base);
vbdev_split_base_free(split_base);
}
return rc;