[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/54] block/iscsi: cancel libiscsi task when ABORT T
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 15/54] block/iscsi: cancel libiscsi task when ABORT TASK TMF completes |
Date: |
Wed, 12 Dec 2018 16:22:36 +0100 |
From: Stefan Hajnoczi <address@hidden>
The libiscsi iscsi_task_mgmt_async() API documentation says:
abort_task will also cancel the scsi task. The callback for the scsi
task will be invoked with SCSI_STATUS_CANCELLED
The libiscsi implementation does not fulfil this promise. The task's
callback is not invoked and its struct iscsi_pdu remains in the internal
list (effectively leaked).
This patch invokes the libiscsi iscsi_scsi_cancel_task() API to force
the task's callback to be invoked with SCSI_STATUS_CANCELLED when the
ABORT TASK TMF completes and the task's callback hasn't been invoked
yet.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/iscsi.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index abb872d..a7e8c1f 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -295,8 +295,12 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int
status, void *command_data,
{
IscsiAIOCB *acb = private_data;
- acb->status = -ECANCELED;
- iscsi_schedule_bh(acb);
+ /* If the command callback hasn't been called yet, drop the task */
+ if (!acb->bh) {
+ /* Call iscsi_aio_ioctl_cb() with SCSI_STATUS_CANCELLED */
+ iscsi_scsi_cancel_task(iscsi, acb->task);
+ }
+
qemu_aio_unref(acb); /* acquired in iscsi_aio_cancel() */
}
@@ -947,6 +951,14 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status,
{
IscsiAIOCB *acb = opaque;
+ if (status == SCSI_STATUS_CANCELLED) {
+ if (!acb->bh) {
+ acb->status = -ECANCELED;
+ iscsi_schedule_bh(acb);
+ }
+ return;
+ }
+
acb->status = 0;
if (status < 0) {
error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s",
--
1.8.3.1
- [Qemu-devel] [PULL 14/54] block/iscsi: fix ioctl cancel use-after-free, (continued)
- [Qemu-devel] [PULL 14/54] block/iscsi: fix ioctl cancel use-after-free, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 05/54] checkpatch: improve handling of multiple patches or files, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 20/54] build-sys: build with Vista API by default, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 07/54] pam: wrap MemoryRegion initialization in a transaction, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 03/54] checkpatch: fix premature exit when no input or --mailback, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 06/54] checkpatch: colorize output to terminal, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 25/54] qemu/queue.h: do not access tqe_prev directly, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 24/54] compiler.h: Add an explicit check for the compiler version, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 13/54] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events(), Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 16/54] esp-pci: Fix status register write erase control, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 15/54] block/iscsi: cancel libiscsi task when ABORT TASK TMF completes,
Paolo Bonzini <=
- [Qemu-devel] [PULL 02/54] vhost-user-bridge: fix "unknown type name" compilation error, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 26/54] vfio: make vfio_address_spaces static, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 22/54] test: execute g_test_run when tests are skipped, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 17/54] scsi: esp: Defer command completion until previous interrupts have been handled, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 21/54] RFC: qga: drop < Vista compatibility, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 19/54] build-sys: move windows defines in osdep.h header, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 10/54] memory: update coalesced_range on transaction_commit, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 28/54] qemu/queue.h: typedef QTAILQ heads, Paolo Bonzini, 2018/12/12
- [Qemu-devel] [PULL 12/54] block/iscsi: drop unused IscsiAIOCB->buf field, Paolo Bonzini, 2018/12/12