ut/bdev_nvme: Fix bug in spdk_nvme_ctrlr_reset_async/poll_async() stubs
In the SPDK NVMe driver, spdk_nvme_ctrlr_reset_async() sets ctrlr->is_failed to false and spdk_nvme_ctrlr_reset_poll_async() sets ctrlr->is_failed to true if it fails. On the other hand, in the unit test for the NVMe bdev module, the stub for spdk_nvme_ctrlr_reset_async() does nothing and the stub for spdk_nvme_ctrlr_reset_poll_async() sets ctrlr->is_failed to false if it succeeds. This bug made us very difficult to write unit test for I/O retry. Hence fix this bug. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ic0dcf1109ce543a53fca74708fc86c8c74a17692 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9829 Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
6c8fd33e6c
commit
440ee15bf3
@ -714,25 +714,19 @@ spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr *ctrlr)
|
|
||||||
{
|
|
||||||
if (ctrlr->fail_reset) {
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctrlr->is_failed = false;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvme_ctrlr_reset_poll_async(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx)
|
spdk_nvme_ctrlr_reset_poll_async(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_ctrlr *ctrlr = ctrlr_reset_ctx->ctrlr;
|
struct spdk_nvme_ctrlr *ctrlr = ctrlr_reset_ctx->ctrlr;
|
||||||
|
|
||||||
free(ctrlr_reset_ctx);
|
free(ctrlr_reset_ctx);
|
||||||
return spdk_nvme_ctrlr_reset(ctrlr);
|
|
||||||
|
if (ctrlr->fail_reset) {
|
||||||
|
ctrlr->is_failed = true;
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -746,6 +740,8 @@ spdk_nvme_ctrlr_reset_async(struct spdk_nvme_ctrlr *ctrlr,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctrlr->is_failed = false;
|
||||||
|
|
||||||
ctrlr_reset_ctx->ctrlr = ctrlr;
|
ctrlr_reset_ctx->ctrlr = ctrlr;
|
||||||
*reset_ctx = ctrlr_reset_ctx;
|
*reset_ctx = ctrlr_reset_ctx;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user