bdev/nvme/bdev_nvme_rpc.c: apply_firmware_complete: free bdev_io after each command finish

apply_firmware_complete bug fix: after each
firmware image download command finished,
apply_firmware_complete is called and issue the next
firmware image download command, and get another bdev_io.
After last command, apply_firmware_complete_reset
only release the last bdev_io, and all the ios in previous
commands are not release.
So after rpc_bdev_nvme_apply_firmware cycling,
the io pool will be used up and cause assert.

Signed-off-by: Gu, Zhimin <kookoo.gu@intel.com>
Change-Id: Icb1c722d85b1985521e5f25031ae70557b7ba84a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11586
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
zgu3 2022-02-15 09:02:30 +08:00 committed by Jim Harris
parent 160af0934e
commit af2bd57875

View File

@ -901,10 +901,11 @@ apply_firmware_complete(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg
struct firmware_update_info *firm_ctx = cb_arg;
enum spdk_nvme_fw_commit_action commit_action = SPDK_NVME_FW_COMMIT_REPLACE_AND_ENABLE_IMG;
spdk_bdev_free_io(bdev_io);
if (!success) {
spdk_jsonrpc_send_error_response(firm_ctx->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"firmware download failed .");
spdk_bdev_free_io(bdev_io);
apply_firmware_cleanup(firm_ctx);
return;
}
@ -927,7 +928,6 @@ apply_firmware_complete(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg
if (rc) {
spdk_jsonrpc_send_error_response(firm_ctx->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"firmware commit failed.");
spdk_bdev_free_io(bdev_io);
apply_firmware_cleanup(firm_ctx);
return;
}
@ -943,7 +943,6 @@ apply_firmware_complete(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg
if (rc) {
spdk_jsonrpc_send_error_response(firm_ctx->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"firmware download failed.");
spdk_bdev_free_io(bdev_io);
apply_firmware_cleanup(firm_ctx);
return;
}