test/unit: Make sure the function runs correctly
1,add a judgement to ensure spdk_blob_close() runs correctly. 2,make sure the command has been completed before _spdk_bs_free() which would avoid heap-use-after-free. Change-Id: I698521d8d4d8e1d8a7374665d27d6eec6d0b85f5 Signed-off-by: JinYu <jin.yu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449517 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
6a67d5178e
commit
3a5abc63b8
@ -3539,6 +3539,8 @@ blob_dirty_shutdown(void)
|
||||
free_clusters = spdk_bs_free_cluster_count(g_bs);
|
||||
|
||||
spdk_blob_close(blob, blob_op_complete, NULL);
|
||||
poll_threads();
|
||||
CU_ASSERT(g_bserrno == 0);
|
||||
blob = NULL;
|
||||
g_blob = NULL;
|
||||
g_blobid = SPDK_BLOBID_INVALID;
|
||||
@ -3645,6 +3647,8 @@ blob_dirty_shutdown(void)
|
||||
free_clusters = spdk_bs_free_cluster_count(g_bs);
|
||||
|
||||
spdk_blob_close(blob, blob_op_complete, NULL);
|
||||
poll_threads();
|
||||
CU_ASSERT(g_bserrno == 0);
|
||||
blob = NULL;
|
||||
g_blob = NULL;
|
||||
g_blobid = SPDK_BLOBID_INVALID;
|
||||
@ -3749,6 +3753,7 @@ blob_dirty_shutdown(void)
|
||||
|
||||
spdk_blob_close(blob, blob_op_complete, NULL);
|
||||
poll_threads();
|
||||
CU_ASSERT(g_bserrno == 0);
|
||||
blob = NULL;
|
||||
g_blob = NULL;
|
||||
g_blobid = SPDK_BLOBID_INVALID;
|
||||
@ -3769,6 +3774,7 @@ blob_dirty_shutdown(void)
|
||||
|
||||
spdk_blob_close(blob, blob_op_complete, NULL);
|
||||
poll_threads();
|
||||
CU_ASSERT(g_bserrno == 0);
|
||||
blob = NULL;
|
||||
g_blob = NULL;
|
||||
g_blobid = SPDK_BLOBID_INVALID;
|
||||
@ -3806,6 +3812,8 @@ blob_dirty_shutdown(void)
|
||||
CU_ASSERT(free_clusters == spdk_bs_free_cluster_count(g_bs));
|
||||
|
||||
spdk_blob_close(blob, blob_op_complete, NULL);
|
||||
poll_threads();
|
||||
CU_ASSERT(g_bserrno == 0);
|
||||
blob = NULL;
|
||||
g_blob = NULL;
|
||||
g_blobid = SPDK_BLOBID_INVALID;
|
||||
|
Loading…
x
Reference in New Issue
Block a user