bdev/iscsi: fix double spdk_bdev_module_finish_done() call
bdev_iscsi_lun_cleanup() was not accounting for LUNs getting cleaned up before the module_finish function was called. This resulted in the bdev/iscsi module calling spdk_bdev_module_finish_done twice which resulted in io_device_unregister not found errors and possible seg faults. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I42c3e0af250e0abcea1cd88ffd3c041ebdaeea49 Reviewed-on: https://review.gerrithub.io/415372 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
1a6d593345
commit
7717cfcacc
@ -63,6 +63,7 @@ static TAILQ_HEAD(, bdev_iscsi_lun) g_iscsi_lun_head = TAILQ_HEAD_INITIALIZER(g_
|
|||||||
static TAILQ_HEAD(, bdev_iscsi_conn_req) g_iscsi_conn_req = TAILQ_HEAD_INITIALIZER(
|
static TAILQ_HEAD(, bdev_iscsi_conn_req) g_iscsi_conn_req = TAILQ_HEAD_INITIALIZER(
|
||||||
g_iscsi_conn_req);
|
g_iscsi_conn_req);
|
||||||
static struct spdk_poller *g_conn_poller = NULL;
|
static struct spdk_poller *g_conn_poller = NULL;
|
||||||
|
static bool g_finish_in_process = false;
|
||||||
|
|
||||||
struct bdev_iscsi_io {
|
struct bdev_iscsi_io {
|
||||||
struct spdk_thread *submit_td;
|
struct spdk_thread *submit_td;
|
||||||
@ -140,7 +141,7 @@ bdev_iscsi_lun_cleanup(struct bdev_iscsi_lun *lun)
|
|||||||
TAILQ_REMOVE(&g_iscsi_lun_head, lun, link);
|
TAILQ_REMOVE(&g_iscsi_lun_head, lun, link);
|
||||||
iscsi_destroy_context(lun->context);
|
iscsi_destroy_context(lun->context);
|
||||||
iscsi_free_lun(lun);
|
iscsi_free_lun(lun);
|
||||||
if (TAILQ_EMPTY(&g_iscsi_lun_head)) {
|
if (TAILQ_EMPTY(&g_iscsi_lun_head) && g_finish_in_process) {
|
||||||
bdev_iscsi_finish_done();
|
bdev_iscsi_finish_done();
|
||||||
spdk_bdev_module_finish_done();
|
spdk_bdev_module_finish_done();
|
||||||
}
|
}
|
||||||
@ -164,6 +165,12 @@ bdev_iscsi_finish(void)
|
|||||||
{
|
{
|
||||||
struct bdev_iscsi_lun *lun, *tmp;
|
struct bdev_iscsi_lun *lun, *tmp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set this flag so that bdev_iscsi_lun_cleanup knows it needs to mark
|
||||||
|
* the module finish as done when the TAILQ is not empty.
|
||||||
|
*/
|
||||||
|
g_finish_in_process = true;
|
||||||
|
|
||||||
if (TAILQ_EMPTY(&g_iscsi_lun_head)) {
|
if (TAILQ_EMPTY(&g_iscsi_lun_head)) {
|
||||||
bdev_iscsi_finish_done();
|
bdev_iscsi_finish_done();
|
||||||
spdk_bdev_module_finish_done();
|
spdk_bdev_module_finish_done();
|
||||||
|
Loading…
Reference in New Issue
Block a user