bdev/nvme: check the return value for spdk_nvme_probe_poll_async()
When there is an error returned from low level driver, we should unregister the poller and free the context, or it may get double free when reaching next poll round. Fix issue #1156. Change-Id: I34ca605f11249b885756d761291aebbb7a382d7e Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482215 Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
2c8ddd08bd
commit
56c7da0e3b
@ -1522,8 +1522,13 @@ static int
|
||||
bdev_nvme_async_poll(void *arg)
|
||||
{
|
||||
struct nvme_async_probe_ctx *ctx = arg;
|
||||
int rc;
|
||||
|
||||
spdk_nvme_probe_poll_async(ctx->probe_ctx);
|
||||
rc = spdk_nvme_probe_poll_async(ctx->probe_ctx);
|
||||
if (spdk_unlikely(rc != -EAGAIN && rc != 0)) {
|
||||
spdk_poller_unregister(&ctx->poller);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user