scsi/bdev: free bdev_io when there are split requests

Only the last bdev_io can be freed without this fix.

Change-Id: I0d05b5d89e38ef60872ebc0f23aaed0c622593c4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7571
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
This commit is contained in:
Changpeng Liu 2021-04-23 22:53:38 +08:00 committed by Tomasz Zawadzki
parent 20698a4a8d
commit 518d28dba9

View File

@ -1397,13 +1397,13 @@ bdev_scsi_task_complete_unmap_cmd(struct spdk_bdev_io *bdev_io, bool success,
ctx->count--;
task->bdev_io = bdev_io;
if (task->status == SPDK_SCSI_STATUS_GOOD) {
spdk_bdev_io_get_scsi_status(bdev_io, &sc, &sk, &asc, &ascq);
spdk_scsi_task_set_status(task, sc, sk, asc, ascq);
}
spdk_bdev_free_io(bdev_io);
if (ctx->count == 0) {
scsi_lun_complete_task(task->lun, task);
free(ctx);