From 9f12ec9d32f1f7592f05d55bba3056f479e22d07 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Fri, 13 Oct 2017 11:46:23 +0200 Subject: [PATCH] lvol: remove lvol from lvol_store->lvols list once in lvol destroy spdk_lvol_destroy() and spdk_lvol_close() behave very similar to each other. With exception that spdk_lvol_destroy() deletes blob, after closing the blob. The order of calls in spdk_lvol_destroy() case: - spdk_lvo_destroy() calls spdk_bs_md_close_blob() - _spdk_lvol_delete_blob_cb is callback from closing the blob, which calls spdk_bs_md_delete_blob() - _spdk_lvol_close_blob_cb is callback from deleting the blob The order of calls in spdk_lvol_close() case: - spdk_lvo_close() calls spdk_bs_md_close_blob() - _spdk_lvol_close_blob_cb is callback from closing the blob Lvol was removed from lvol store lvol list in two cases, spdk_lvol_destroy() and _spdk_lvol_close_blob_cb(). This caused lvol to be removed twice from the list in lvol destroy case. This change makes it so it is more clear, that lvol is removed from lvol store lvol list in both cases and just once. Signed-off-by: Tomasz Zawadzki Change-Id: I204645850ca2c46f03a9035518b00f50c75e2b1a Reviewed-on: https://review.gerrithub.io/382425 Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris Tested-by: SPDK Automated Test System --- lib/lvol/lvol.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lvol/lvol.c b/lib/lvol/lvol.c index 881cf566b..d16aa5d0a 100644 --- a/lib/lvol/lvol.c +++ b/lib/lvol/lvol.c @@ -299,8 +299,6 @@ _spdk_lvol_close_blob_cb(void *cb_arg, int lvolerrno) return; } - TAILQ_REMOVE(&lvol->lvol_store->lvols, lvol, link); - if (lvol->lvol_store->destruct_req && TAILQ_EMPTY(&lvol->lvol_store->lvols)) { spdk_lvs_unload(lvol->lvol_store, _spdk_lvs_destruct_cb, lvol->lvol_store->destruct_req); } @@ -514,6 +512,7 @@ spdk_lvol_close(struct spdk_lvol *lvol) return; } + TAILQ_REMOVE(&lvol->lvol_store->lvols, lvol, link); spdk_bs_md_close_blob(&(lvol->blob), _spdk_lvol_close_blob_cb, lvol); }