lib/nvme: add timeout to fabric connect commands.

We can't afford to wait here blocking forever. Add a
reasonable timeout (1 second) to this command.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I7e373c5515d42a46403f03d7d09e72225f8910ff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3563
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Seth Howell 2020-07-28 14:35:13 -07:00 committed by Tomasz Zawadzki
parent 5682de86c4
commit a22f55658c

View File

@ -40,6 +40,12 @@
#include "spdk/endian.h"
#include "spdk/string.h"
#ifdef DEBUG
#define NVME_FABRIC_CONNECT_COMMAND_TIMEOUT 0
#else
#define NVME_FABRIC_CONNECT_COMMAND_TIMEOUT 1
#endif
static int
nvme_fabric_prop_set_cmd(struct spdk_nvme_ctrlr *ctrlr,
uint32_t offset, uint8_t size, uint64_t value)
@ -454,7 +460,8 @@ nvme_fabric_qpair_connect(struct spdk_nvme_qpair *qpair, uint32_t num_entries)
return rc;
}
if (nvme_wait_for_completion(qpair, status)) {
/* If we time out, the qpair will abort the request upon destruction. */
if (nvme_wait_for_completion_timeout(qpair, status, NVME_FABRIC_CONNECT_COMMAND_TIMEOUT)) {
SPDK_ERRLOG("Connect command failed\n");
spdk_free(nvmf_data);
if (!status->timed_out) {