diff --git a/lib/bdev/iscsi/bdev_iscsi.c b/lib/bdev/iscsi/bdev_iscsi.c index a41514d243..2cefb7f4b4 100644 --- a/lib/bdev/iscsi/bdev_iscsi.c +++ b/lib/bdev/iscsi/bdev_iscsi.c @@ -100,7 +100,6 @@ struct bdev_iscsi_conn_req { spdk_bdev_iscsi_create_cb create_cb; spdk_bdev_iscsi_create_cb create_cb_arg; TAILQ_ENTRY(bdev_iscsi_conn_req) link; - bool deleted; }; static int @@ -537,7 +536,7 @@ complete_conn_req(struct bdev_iscsi_conn_req *req, struct spdk_bdev *bdev, { TAILQ_REMOVE(&g_iscsi_conn_req, req, link); req->create_cb(req->create_cb_arg, bdev, status); - req->deleted = true; + free(req); } static int @@ -646,10 +645,12 @@ iscsi_bdev_conn_poll(void *arg) { struct bdev_iscsi_conn_req *req, *tmp; struct pollfd pfd; + struct iscsi_context *context; TAILQ_FOREACH_SAFE(req, &g_iscsi_conn_req, link, tmp) { - pfd.fd = iscsi_get_fd(req->context); - pfd.events = iscsi_which_events(req->context); + context = req->context; + pfd.fd = iscsi_get_fd(context); + pfd.events = iscsi_which_events(context); pfd.revents = 0; if (poll(&pfd, 1, 0) < 0) { SPDK_ERRLOG("poll failed\n"); @@ -657,14 +658,10 @@ iscsi_bdev_conn_poll(void *arg) } if (pfd.revents != 0) { - if (iscsi_service(req->context, pfd.revents) < 0) { - SPDK_ERRLOG("iscsi_service failed: %s\n", iscsi_get_error(req->context)); + if (iscsi_service(context, pfd.revents) < 0) { + SPDK_ERRLOG("iscsi_service failed: %s\n", iscsi_get_error(context)); } } - - if (req->deleted) { - free(req); - } } return -1;