From af2bd57875c9e6c07677b49e3bd22bd4a621ad87 Mon Sep 17 00:00:00 2001 From: zgu3 Date: Tue, 15 Feb 2022 09:02:30 +0800 Subject: [PATCH] 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 Change-Id: Icb1c722d85b1985521e5f25031ae70557b7ba84a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11586 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris --- module/bdev/nvme/bdev_nvme_rpc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme_rpc.c b/module/bdev/nvme/bdev_nvme_rpc.c index 2bca90a652..eac9e52498 100644 --- a/module/bdev/nvme/bdev_nvme_rpc.c +++ b/module/bdev/nvme/bdev_nvme_rpc.c @@ -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; }