lvol: Fix for lvol failed deletion flow
lvol should not only be freed but also removed from lvols list when deletion fails. Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: I3a047e1cc611e71b1544ca77c256a879dd2efdae Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446619 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
06ec27a54d
commit
e87e8263df
@ -902,14 +902,12 @@ _spdk_lvol_delete_blob_cb(void *cb_arg, int lvolerrno)
|
||||
struct spdk_lvol *lvol = req->lvol;
|
||||
|
||||
if (lvolerrno < 0) {
|
||||
SPDK_ERRLOG("Could not delete blob on lvol\n");
|
||||
goto end;
|
||||
SPDK_ERRLOG("Could not remove blob on lvol gracefully - forced removal\n");
|
||||
} else {
|
||||
SPDK_INFOLOG(SPDK_LOG_LVOL, "Lvol %s deleted\n", lvol->unique_id);
|
||||
}
|
||||
|
||||
TAILQ_REMOVE(&lvol->lvol_store->lvols, lvol, link);
|
||||
SPDK_INFOLOG(SPDK_LOG_LVOL, "Lvol %s deleted\n", lvol->unique_id);
|
||||
|
||||
end:
|
||||
_spdk_lvol_free(lvol);
|
||||
req->cb_fn(req->cb_arg, lvolerrno);
|
||||
free(req);
|
||||
|
@ -74,6 +74,7 @@ int g_lvserrno;
|
||||
int g_close_super_status;
|
||||
int g_resize_rc;
|
||||
int g_inflate_rc;
|
||||
int g_remove_rc;
|
||||
bool g_lvs_rename_blob_open_error = false;
|
||||
struct spdk_lvol_store *g_lvol_store;
|
||||
struct spdk_lvol *g_lvol;
|
||||
@ -326,7 +327,7 @@ spdk_bs_delete_blob(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
||||
}
|
||||
}
|
||||
|
||||
cb_fn(cb_arg, 0);
|
||||
cb_fn(cb_arg, g_remove_rc);
|
||||
}
|
||||
|
||||
spdk_blob_id
|
||||
@ -859,6 +860,20 @@ lvol_destroy_fail(void)
|
||||
spdk_lvol_destroy(g_lvol, destroy_cb, NULL);
|
||||
CU_ASSERT(g_lvserrno == 0);
|
||||
|
||||
spdk_lvol_create(g_lvol_store, "lvol", 10, false, LVOL_CLEAR_WITH_DEFAULT,
|
||||
lvol_op_with_handle_complete, NULL);
|
||||
CU_ASSERT(g_lvserrno == 0);
|
||||
SPDK_CU_ASSERT_FATAL(g_lvol != NULL);
|
||||
|
||||
spdk_lvol_close(g_lvol, close_cb, NULL);
|
||||
CU_ASSERT(g_lvserrno == 0);
|
||||
|
||||
g_remove_rc = -1;
|
||||
spdk_lvol_destroy(g_lvol, destroy_cb, NULL);
|
||||
CU_ASSERT(g_lvserrno != 0);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_lvol_store->lvols));
|
||||
g_remove_rc = 0;
|
||||
|
||||
g_lvserrno = -1;
|
||||
rc = spdk_lvs_unload(g_lvol_store, lvol_store_op_complete, NULL);
|
||||
CU_ASSERT(rc == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user