From patchwork Thu Mar 17 11:08:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 8610101 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 83E21C0553 for ; Thu, 17 Mar 2016 11:10:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC08A202EC for ; Thu, 17 Mar 2016 11:10:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 288C2202AE for ; Thu, 17 Mar 2016 11:10:33 +0000 (UTC) Received: from localhost ([::1]:34115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agVp2-0004Pr-Ge for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Mar 2016 07:10:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agVnH-0001Vw-18 for qemu-devel@nongnu.org; Thu, 17 Mar 2016 07:08:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agVnG-0005mO-0k for qemu-devel@nongnu.org; Thu, 17 Mar 2016 07:08:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agVnF-0005lh-Rj for qemu-devel@nongnu.org; Thu, 17 Mar 2016 07:08:41 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 948CA64455; Thu, 17 Mar 2016 11:08:41 +0000 (UTC) Received: from localhost (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2HB8e9B019381; Thu, 17 Mar 2016 07:08:41 -0400 From: Stefan Hajnoczi To: Date: Thu, 17 Mar 2016 11:08:35 +0000 Message-Id: <1458212915-32614-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1458212915-32614-1-git-send-email-stefanha@redhat.com> References: <1458212915-32614-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 17 Mar 2016 11:08:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: Peter Maydell , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 2/2] Revert "qed: Implement .bdrv_drain" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01. Note that commit df9a681dc9ad41c9cdeb9ecc5d060ba9abd27e01 included some unrelated hunks, possibly due to a merge failure or an overlooked squash. This only reverts the qed .bdrv_drain() implementation. The qed .bdrv_drain() implementation is unsafe and can lead to a double request completion. Paolo Bonzini reports: "The problem is that bdrv_qed_drain calls qed_plug_allocating_write_reqs unconditionally, but this is not correct if an allocating write is queued. In this case, qed_unplug_allocating_write_reqs will restart the allocating write and possibly cause it to complete. The aiocb however is still in use for the L2/L1 table writes, and will then be completed again as soon as the table writes are stable." For QEMU 2.6 we can simply revert this commit. A full solution for the qed need check timer may be added if the bdrv_drain() implementation is extended. Reported-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi Acked-by: Paolo Bonzini Message-id: 1457431876-8475-1-git-send-email-stefanha@redhat.com --- block/qed.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/block/qed.c b/block/qed.c index 8de7dd0..5a58856 100644 --- a/block/qed.c +++ b/block/qed.c @@ -377,18 +377,6 @@ static void bdrv_qed_attach_aio_context(BlockDriverState *bs, } } -static void bdrv_qed_drain(BlockDriverState *bs) -{ - BDRVQEDState *s = bs->opaque; - - /* Cancel timer and start doing I/O that were meant to happen as if it - * fired, that way we get bdrv_drain() taking care of the ongoing requests - * correctly. */ - qed_cancel_need_check_timer(s); - qed_plug_allocating_write_reqs(s); - bdrv_aio_flush(s->bs, qed_clear_need_check, s); -} - static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -1694,7 +1682,6 @@ static BlockDriver bdrv_qed = { .bdrv_check = bdrv_qed_check, .bdrv_detach_aio_context = bdrv_qed_detach_aio_context, .bdrv_attach_aio_context = bdrv_qed_attach_aio_context, - .bdrv_drain = bdrv_qed_drain, }; static void bdrv_qed_init(void)