From 91b13bd105c01fec41caa448c9107e5dfe03b2aa Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 4 May 2017 12:31:57 -0700 Subject: [PATCH] scsi: don't change bdev_io status in spdk_scsi_task_put() The SCSI task bdev I/O should never be pending when spdk_scsi_task_put() is called, and just setting the status to failed is not correct (when the bdev eventually completes the I/O, it will write into the now-freed bdev_io, which may be reused by someone else). Change-Id: Iaad6ce9ab41539652abc40147fed47c5012109dc Signed-off-by: Daniel Verkamp --- lib/bdev/bdev.c | 1 + lib/scsi/task.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index e1d21dd63..911ef5e24 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -838,6 +838,7 @@ spdk_bdev_free_io(struct spdk_bdev_io *bdev_io) if (bdev_io->status == SPDK_BDEV_IO_STATUS_PENDING) { SPDK_ERRLOG("bdev_io is in pending state\n"); + assert(false); return -1; } diff --git a/lib/scsi/task.c b/lib/scsi/task.c index 282aab8f3..a00278e85 100644 --- a/lib/scsi/task.c +++ b/lib/scsi/task.c @@ -55,10 +55,6 @@ spdk_scsi_task_put(struct spdk_scsi_task *task) } if (bdev_io) { - /* due to lun reset, the bdev_io status could be pending */ - if (bdev_io->status == SPDK_BDEV_IO_STATUS_PENDING) { - bdev_io->status = SPDK_BDEV_IO_STATUS_FAILED; - } spdk_bdev_free_io(bdev_io); }