From patchwork Sat Oct 21 05:34:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhengui li X-Patchwork-Id: 10021261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F68660224 for ; Sat, 21 Oct 2017 05:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 329B328E76 for ; Sat, 21 Oct 2017 05:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 243EF28E7E; Sat, 21 Oct 2017 05:35:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id DE15428E76 for ; Sat, 21 Oct 2017 05:35:16 +0000 (UTC) Received: from localhost ([::1]:56718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5mRG-0007dQ-F4 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 21 Oct 2017 01:35:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5mQc-0007bp-1f for qemu-devel@nongnu.org; Sat, 21 Oct 2017 01:34:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5mQa-0003Kg-IU for qemu-devel@nongnu.org; Sat, 21 Oct 2017 01:34:33 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2272) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5mQV-0003IL-SQ; Sat, 21 Oct 2017 01:34:28 -0400 Received: from 172.30.72.58 (EHLO DGGEMS404-HUB.china.huawei.com) ([172.30.72.58]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DJP68792; Sat, 21 Oct 2017 13:34:18 +0800 (CST) Received: from HGHY1l002846723.china.huawei.com (10.177.251.193) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.301.0; Sat, 21 Oct 2017 13:34:08 +0800 From: Zhengui Li To: , , , Date: Sat, 21 Oct 2017 13:34:00 +0800 Message-ID: <1508564040-120700-1-git-send-email-lizhengui@huawei.com> X-Mailer: git-send-email 2.7.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.251.193] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0205.59EADC5C.000E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c245e79c21666bab114ac7f523af0db8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 45.249.212.191 Subject: [Qemu-devel] [PATCH] block: all I/O should be completed before removing throttle timers. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xieyingtai@huawei.com, lina.lulina@huawei.com, lizhengui@huawei.com, qemu-block@nongnu.org, subo7@huawei.com, eric.fangyi@huawei.com, qemu-devel@nongnu.org, wangjie88@huawei.com, sochin.jiang@huawei.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhengui In blk_remove_bs, all I/O should be completed before removing throttle timers. If there has inflight I/O, removing throttle timers here will cause the inflight I/O never return. This patch add bdrv_drained_begin before throttle_timers_detach_aio_context to let all I/O completed before removing throttle timers. Signed-off-by: Zhengui Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefan Hajnoczi Reviewed-by: Alberto Garcia --- block/block-backend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index 45d9101..9edc452 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -660,7 +660,11 @@ void blk_remove_bs(BlockBackend *blk) notifier_list_notify(&blk->remove_bs_notifiers, blk); if (blk->public.throttle_group_member.throttle_state) { tt = &blk->public.throttle_group_member.throttle_timers; + BlockDriverState *bs; + bs = blk_bs(blk); + bdrv_drained_begin(bs); throttle_timers_detach_aio_context(tt); + bdrv_drained_end(bs); } blk_update_root_state(blk);