bdev/aio: access 'spdk_bdev_io' before 'spdk_bdev_io_complete' called

'spdk_bdev_io' could be freed after calling 'spdk_bdev_io_complete',
fix this potential issue in aio.

Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I2e67ec44d9ffc0dda4f5753beba06b8a249456ca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5463
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
This commit is contained in:
Sochin Jiang 2020-12-06 14:02:44 +08:00 committed by Tomasz Zawadzki
parent cac9322dc9
commit 7083e01b9f

View File

@ -341,8 +341,8 @@ bdev_aio_io_channel_poll(struct bdev_aio_io_channel *io_ch)
status = SPDK_BDEV_IO_STATUS_SUCCESS; status = SPDK_BDEV_IO_STATUS_SUCCESS;
} }
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(aio_task), status);
aio_task->ch->io_inflight--; aio_task->ch->io_inflight--;
spdk_bdev_io_complete(spdk_bdev_io_from_ctx(aio_task), status);
} }
return nr; return nr;