From c1f9a62ca30caa07145cdafebb5b6fe9b2c22b9f Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Tue, 26 Nov 2019 07:31:30 -0500 Subject: [PATCH] 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 Change-Id: I187bc61bb6e094c9c740a987e7d14760551a0503 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475872 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- test/unit/lib/blob/blob.c/blob_ut.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/unit/lib/blob/blob.c/blob_ut.c b/test/unit/lib/blob/blob.c/blob_ut.c index e23bf1ffe..3a2ef71a2 100644 --- a/test/unit/lib/blob/blob.c/blob_ut.c +++ b/test/unit/lib/blob/blob.c/blob_ut.c @@ -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();