nvme: Fail the qpair if it is marked as failure when process the completion queue.

This make sure the qpair failure could be started from upper level application.

Change-Id: I7e04fe36929cc634ddf0078db96fbc40afb38f8c
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
Cunyin Chang 2017-01-16 12:49:21 +08:00 committed by Jim Harris
parent 919c4b540e
commit 5f3e922a6a
3 changed files with 14 additions and 6 deletions

View File

@ -346,16 +346,14 @@ nvme_ctrlr_set_supported_features(struct spdk_nvme_ctrlr *ctrlr)
void
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
{
struct spdk_nvme_qpair *qpair;
/*
* Set the flag here and leave the work failure of qpairs to
* spdk_nvme_qpair_process_completions().
*/
if (hot_remove) {
ctrlr->is_removed = true;
}
ctrlr->is_failed = true;
nvme_qpair_fail(ctrlr->adminq);
TAILQ_FOREACH(qpair, &ctrlr->active_io_qpairs, tailq) {
nvme_qpair_fail(qpair);
}
}
static void

View File

@ -1866,6 +1866,11 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
uint32_t num_completions = 0;
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
if (qpair->ctrlr->is_failed) {
nvme_qpair_fail(qpair);
return 0;
}
if (!nvme_pcie_qpair_check_enabled(qpair)) {
/*
* qpair is not enabled, likely because a controller reset is

View File

@ -65,6 +65,11 @@ struct io_request {
bool invalid_second_addr;
};
void
nvme_qpair_fail(struct spdk_nvme_qpair *qpair)
{
}
void
nvme_ctrlr_fail(struct spdk_nvme_ctrlr *ctrlr, bool hot_remove)
{