From nobody Sun Nov 2 00:43:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508564146971612.8942227035942; Fri, 20 Oct 2017 22:35:46 -0700 (PDT) Received: from localhost ([::1]:56721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5mRT-00080L-US for importer@patchew.org; Sat, 21 Oct 2017 01:35:27 -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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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: Alberto Garcia Reviewed-by: Stefan Hajnoczi --- 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 =3D &blk->public.throttle_group_member.throttle_timers; + BlockDriverState *bs; + bs =3D blk_bs(blk); + bdrv_drained_begin(bs); throttle_timers_detach_aio_context(tt); + bdrv_drained_end(bs); } =20 blk_update_root_state(blk); --=20 2.7.2.windows.1