[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 34/51] block/iscsi: use a bh to schedule co reentran
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 34/51] block/iscsi: use a bh to schedule co reentrance |
Date: |
Fri, 21 Feb 2014 02:17:10 -0600 |
From: Peter Lieven <address@hidden>
this fixes a potential segfault and performance regression.
If the coroutine is reentered directly in the iscsi_co_generic_cb
iscsi_process_{read,write} are interrupted and reentered any
time later. One the one hand this could happen after an iscsi_close
where the iscsi context is already gone (segfault). On the
other hand this limits the number of processed callbacks
in each aio_dispatch to one (potential performance regression).
Cc: address@hidden
Signed-off-by: Peter Lieven <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
(cherry picked from commit 8b9dfe9098d91e06a3dd6376624307fe5fa13be8)
Signed-off-by: Michael Roth <address@hidden>
---
block/iscsi.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index a2d578c..a410a28 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -65,6 +65,7 @@ typedef struct IscsiTask {
int do_retry;
struct scsi_task *task;
Coroutine *co;
+ QEMUBH *bh;
} IscsiTask;
typedef struct IscsiAIOCB {
@@ -121,6 +122,13 @@ iscsi_schedule_bh(IscsiAIOCB *acb)
qemu_bh_schedule(acb->bh);
}
+static void iscsi_co_generic_bh_cb(void *opaque)
+{
+ struct IscsiTask *iTask = opaque;
+ qemu_bh_delete(iTask->bh);
+ qemu_coroutine_enter(iTask->co, NULL);
+}
+
static void
iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
void *command_data, void *opaque)
@@ -145,7 +153,8 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
out:
if (iTask->co) {
- qemu_coroutine_enter(iTask->co, NULL);
+ iTask->bh = qemu_bh_new(iscsi_co_generic_bh_cb, iTask);
+ qemu_bh_schedule(iTask->bh);
}
}
--
1.7.9.5
- [Qemu-devel] [PATCH 24/51] exec: pass hw address to phys_page_find, (continued)
- [Qemu-devel] [PATCH 24/51] exec: pass hw address to phys_page_find, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 23/51] exec: replace leaf with skip, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 25/51] exec: separate sections and nodes per address space, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 26/51] pc: map PCI address space as catchall region for not mapped addresses, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 28/51] target-mips: fix 64-bit FPU config for user-mode emulation, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 29/51] linux-user: pass correct parameter to do_shmctl(), Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 30/51] linux-user: create target_structs header to place ipc_perm and shmid_ds, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 27/51] piix: fix 32bit pci hole, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 32/51] tcg/optimize: fix known-zero bits for right shift ops, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 31/51] Fix QEMU build on OpenBSD on x86 archs, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 34/51] block/iscsi: use a bh to schedule co reentrance,
Michael Roth <=
- [Qemu-devel] [PATCH 33/51] hpet: fix build with CONFIG_HPET off, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 35/51] qemu_opts_parse(): always check return value, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 38/51] mainstone: Fix duplicate array values for key 'space', Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 36/51] s390x/kvm: Fix diagnose handling., Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 37/51] seccomp: exit if seccomp_init() fails, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 39/51] migration: qmp_migrate(): keep working after syntax error, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 40/51] vfio-pci: Release all MSI-X vectors when disabled, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 41/51] block/curl: Implement the libcurl timer callback interface, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 43/51] scsi: Assign cancel_io vector for scsi_disk_emulate_ops, Michael Roth, 2014/02/21
- [Qemu-devel] [PATCH 42/51] scsi: Support TEST UNIT READY in the dummy LUN0, Michael Roth, 2014/02/21