Nvme: check spdk_nvme_qpair_process_completions return value.

nvme_tcp_qpair_process_completions returns -1 on socket I/O
error. Unless the caller checks this return value (which
spdk_nvme_wait_for_completion_robust_lock currently doesn't),
on connection loss or any other fatal connection
error spdk_nvme_wait_for_completion will never exit the completion
check loop.

Change-Id: I92bb349beb071db312e6c31b84db2a7b51ec486c
Signed-off-by: Andrey Kuzmin <akuzmin@jetstreamsoft.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460657
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Andrey Kuzmin 2019-07-05 22:24:17 +03:00 committed by Changpeng Liu
parent 1500eb7b11
commit fa6bfa80af
2 changed files with 7 additions and 3 deletions

View File

@ -122,7 +122,11 @@ spdk_nvme_wait_for_completion_robust_lock(
nvme_robust_mutex_lock(robust_mutex);
}
spdk_nvme_qpair_process_completions(qpair, 0);
if (spdk_nvme_qpair_process_completions(qpair, 0) < 0) {
status->done = true;
status->cpl.status.sct = SPDK_NVME_SCT_GENERIC;
status->cpl.status.sc = SPDK_NVME_SC_ABORTED_SQ_DELETION;
}
if (robust_mutex) {
nvme_robust_mutex_unlock(robust_mutex);

View File

@ -1587,8 +1587,8 @@ nvme_tcp_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_c
do {
rc = nvme_tcp_read_pdu(tqpair, &reaped);
if (rc < 0) {
SPDK_ERRLOG("Error polling CQ! (%d): %s\n",
errno, spdk_strerror(errno));
SPDK_DEBUGLOG(SPDK_LOG_NVME, "Error polling CQ! (%d): %s\n",
errno, spdk_strerror(errno));
return -1;
} else if (rc == 0) {
/* Partial PDU is read */