ut/blob: fix freeing io_channels

This patch fixes minor unit test deallocations around io_channels.
It has not exposed any issues in blobstore code, but should always be right
to prevent covering up any issues later.

1) Two spdk_bs_free_io_channel() were missing
2) Dirty shutdown should still free bs resources with _spdk_bs_free()

Sample log at the end of UT, before this patch:
thread.c: 200:_free_thread: *ERROR*: thread 0x617000000080 still has channel for io_device blobstore
thread.c: 200:_free_thread: *ERROR*: thread 0x617000000080 still has channel for io_device blobstore
thread.c: 200:_free_thread: *ERROR*: thread 0x617000000080 still has channel for io_device blobstore
thread.c: 180:spdk_thread_lib_fini: *ERROR*: io_device blobstore not unregistered
thread.c: 180:spdk_thread_lib_fini: *ERROR*: io_device blobstore not unregistered

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I187bc61bb6e094c9c740a987e7d14760551a0503
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475872
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2019-11-26 07:31:30 -05:00
parent 8b21bab265
commit c1f9a62ca3

View File

@ -540,6 +540,7 @@ blob_thin_provision(void)
* and try to recover a valid used_cluster map, that blobstore will
* ignore clusters with index 0 since these are unallocated clusters.
*/
_spdk_bs_free(bs);
/* Load an existing blob store and check if invalid_flags is set */
dev = init_dev();
@ -2525,6 +2526,12 @@ blob_xattr(void)
CU_ASSERT((blob->invalid_flags & SPDK_BLOB_INTERNAL_XATTR) == 0);
spdk_blob_close(blob, blob_op_complete, NULL);
poll_threads();
CU_ASSERT(g_bserrno == 0);
spdk_bs_unload(g_bs, bs_op_complete, NULL);
poll_threads();
CU_ASSERT(g_bserrno == 0);
g_bs = NULL;
}
@ -7338,6 +7345,9 @@ blob_io_unit(void)
blob = NULL;
g_blob = NULL;
spdk_bs_free_io_channel(channel);
poll_threads();
/* Unload the blob store */
spdk_bs_unload(g_bs, bs_op_complete, NULL);
poll_threads();