nvmf/vfio-user: delete CQ on vfio-user client disconnect
If the guest performs a hard shutdown we're not deleting the CQs: nvmf_vfio_user_close_qpair calls delete_sq_done, which won't delete the CQ because vu_ctrlr->reset_shn is false. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Change-Id: I383fb985340a0d9d0eb7fea7403372cbdc55a089 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15387 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: John Levon <levon@movementarian.org> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
e398dcdadb
commit
a7885283b3
@ -390,6 +390,7 @@ struct nvmf_vfio_user_ctrlr {
|
|||||||
bool queued_quiesce;
|
bool queued_quiesce;
|
||||||
|
|
||||||
bool reset_shn;
|
bool reset_shn;
|
||||||
|
bool disconnect;
|
||||||
|
|
||||||
uint16_t cntlid;
|
uint16_t cntlid;
|
||||||
struct spdk_nvmf_ctrlr *ctrlr;
|
struct spdk_nvmf_ctrlr *ctrlr;
|
||||||
@ -1731,8 +1732,8 @@ free_sq_reqs(struct nvmf_vfio_user_sq *sq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Deletes a SQ, if this SQ is the last user of the associated CQ
|
/* Deletes a SQ, if this SQ is the last user of the associated CQ
|
||||||
* and the controller is being shut down or reset, then the CQ is
|
* and the controller is being shut down/reset or vfio-user client disconnects,
|
||||||
* also deleted.
|
* then the CQ is also deleted.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
delete_sq_done(struct nvmf_vfio_user_ctrlr *vu_ctrlr, struct nvmf_vfio_user_sq *sq)
|
delete_sq_done(struct nvmf_vfio_user_ctrlr *vu_ctrlr, struct nvmf_vfio_user_sq *sq)
|
||||||
@ -1756,7 +1757,7 @@ delete_sq_done(struct nvmf_vfio_user_ctrlr *vu_ctrlr, struct nvmf_vfio_user_sq *
|
|||||||
* VM may not send DELETE IO SQ/CQ commands, NVMf library
|
* VM may not send DELETE IO SQ/CQ commands, NVMf library
|
||||||
* will disconnect IO queue pairs.
|
* will disconnect IO queue pairs.
|
||||||
*/
|
*/
|
||||||
if (vu_ctrlr->reset_shn) {
|
if (vu_ctrlr->reset_shn || vu_ctrlr->disconnect) {
|
||||||
cqid = sq->cqid;
|
cqid = sq->cqid;
|
||||||
cq = vu_ctrlr->cqs[cqid];
|
cq = vu_ctrlr->cqs[cqid];
|
||||||
|
|
||||||
@ -4731,6 +4732,7 @@ vfio_user_destroy_ctrlr(struct nvmf_vfio_user_ctrlr *ctrlr)
|
|||||||
|
|
||||||
pthread_mutex_lock(&endpoint->lock);
|
pthread_mutex_lock(&endpoint->lock);
|
||||||
endpoint->need_relisten = true;
|
endpoint->need_relisten = true;
|
||||||
|
ctrlr->disconnect = true;
|
||||||
if (TAILQ_EMPTY(&ctrlr->connected_sqs)) {
|
if (TAILQ_EMPTY(&ctrlr->connected_sqs)) {
|
||||||
endpoint->ctrlr = NULL;
|
endpoint->ctrlr = NULL;
|
||||||
free_ctrlr(ctrlr);
|
free_ctrlr(ctrlr);
|
||||||
|
Loading…
Reference in New Issue
Block a user