From f5a357054de156492dae07bef7d508df9fb827b9 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Tue, 14 Feb 2012 11:14:18 +0100
Subject: [PATCH 53/99] Revert "qed: avoid deadlock on emulated synchronous
 I/O"

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <1329218101-24213-54-git-send-email-kwolf@redhat.com>
Patchwork-id: 37246
O-Subject: [RHEL-6.3 qemu-kvm PATCH v2 53/96] Revert "qed: avoid deadlock on emulated synchronous I/O"
Bugzilla: 783950
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

Bugzilla: 783950
Upstream status: n/a

This reverts commit 5adff4d18ebd6e68c0e914946bab058fbc8870ee, which is
a RHEL specific hack to deal with AsyncContexts. We're going to remove
AsyncContext, so it isn't needed any more and would break the build.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qed.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 block/qed.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/block/qed.c b/block/qed.c
index 361646a..1096d30 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1169,14 +1169,6 @@ static bool qed_start_allocating_write(QEDAIOCB *acb)
     }
     if (acb != QSIMPLEQ_FIRST(&s->allocating_write_reqs) ||
         s->allocating_write_reqs_plugged) {
-        /* Queuing an emulated synchronous write causes deadlock since
-         * currently outstanding requests are not in the current async context
-         * and their completion will never be invoked.  Once the block layer
-         * moves to truly asynchronous semantics this failure case will be
-         * eliminated.
-         */
-        assert(get_async_context_id() == 0);
-
         return false;
     }
     return true;
@@ -1311,9 +1303,7 @@ static void qed_aio_read_data(void *opaque, int ret,
     } else if (ret != QED_CLUSTER_FOUND) {
         BlockDriverCompletionFunc *cb = qed_aio_next_io;
 
-        /* See qed_start_allocating_write() for get_async_context_id() hack */
-        if (bs->backing_hd && (acb->flags & QED_AIOCB_COPY_ON_READ) &&
-            get_async_context_id() == 0) {
+        if (bs->backing_hd && (acb->flags & QED_AIOCB_COPY_ON_READ)) {
             if (!qed_start_allocating_write(acb)) {
                 qemu_iovec_reset(&acb->cur_qiov);
                 return; /* wait for current allocating write to complete */
-- 
1.7.7.5

