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
ccee9a9151
commit
2b70bf9291
@ -714,25 +714,19 @@ spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair)
|
||||
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
|
||||
spdk_nvme_ctrlr_reset_poll_async(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx)
|
||||
{
|
||||
struct spdk_nvme_ctrlr *ctrlr = ctrlr_reset_ctx->ctrlr;
|
||||
|
||||
free(ctrlr_reset_ctx);
|
||||
return spdk_nvme_ctrlr_reset(ctrlr);
|
||||
|
||||
if (ctrlr->fail_reset) {
|
||||
ctrlr->is_failed = true;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
@ -746,6 +740,8 @@ spdk_nvme_ctrlr_reset_async(struct spdk_nvme_ctrlr *ctrlr,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ctrlr->is_failed = false;
|
||||
|
||||
ctrlr_reset_ctx->ctrlr = ctrlr;
|
||||
*reset_ctx = ctrlr_reset_ctx;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user