From patchwork Fri Jul 2 21:16:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12356527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DA88C07E95 for ; Fri, 2 Jul 2021 21:19:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1B1EA61357 for ; Fri, 2 Jul 2021 21:19:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B1EA61357 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lzQZA-0004uC-7y for qemu-devel@archiver.kernel.org; Fri, 02 Jul 2021 17:19:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzQX1-0001FH-8P; Fri, 02 Jul 2021 17:17:03 -0400 Received: from mail-eopbgr60106.outbound.protection.outlook.com ([40.107.6.106]:49763 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzQWy-0003iz-V3; Fri, 02 Jul 2021 17:17:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mo3+veGO4YPwyJ3h2CBnDqls0SytjQqYEFy7SqpndEky6QT0piXpX3aTjUYk7A07Y/HCy/R3ysx+7Vqfpn+qmQiiO4AiDnTutK8gAqldvmyUHez5CtA+a/VhUEM4yze86O/gBSn0xV/WDDa2KoCInFA+T5+XIEJo0bTJAMY7dmFjfDB6uQt4M1LSMflpHFKVRzYTUsHfzOxiB1bR3DS7Lr4p1qkvjNapLaLf7BwSU/82tapVZ0iqtFarGx7CjnTHgr10BkFyyjhG8TU83MG1IGio6q0maxYJxMW3fWgVSEH9GCITkKW77kP3uOyo6OuWXQb/WS/xRoK3dBviT2k7mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4h5eTphYW2QrWHpfh7y2NeHN9wsn/Y6vuk8UyXkQP1k=; b=HICQebQtldLAhrnjppdpU9+PJ+F9Jt5DuxDGrlKidPtBy4wmamjyH6aL4FuYncHGE+9hyRrZLZ/nexmRJahbGeHgG7kPiNHAl5eSbHOa2GAHFF44sle20/u4MQ7eoJW0TZiaxksP0Az7B3RQ5e3IyMva91ZzOn4pyktf/Y9/3l1UOds5JQQanSl+sqzKIwqmSq3MPz49I99xXQIYAR9AohPR1JZWSxXhCMOodzronzw/kTl9ZqImhQZAGRxW2K+Iap6KhQe3Y8mw8f0XhwYJc8zM3diIBVGTb7qo2Hn2kC4UoKRvnAhZ/rM4ZXCHHUbQJzVLk0oscyPmjAWNl4EJhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4h5eTphYW2QrWHpfh7y2NeHN9wsn/Y6vuk8UyXkQP1k=; b=Z6qMhjylGyfP+ubVPGoTuG7BD1K2oiznBy6oqyQEmxFUuLRuKTVXnRiDvN+DDmAqTvBGOCywYlIrZk510JO4zE4Z4HaQZkThGHgc9y9nIfj2piOelzoEZNFRX4s08MHEW3VbTZs8aZyPw43ps7l2+IYPjR0+HBGVntfGIaiIvpI= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4691.eurprd08.prod.outlook.com (2603:10a6:20b:cc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 2 Jul 2021 21:16:53 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::75ce:1d52:cb60:e955]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::75ce:1d52:cb60:e955%6]) with mapi id 15.20.4264.026; Fri, 2 Jul 2021 21:16:53 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, dem@openvz.org Subject: [PATCH 1/3] block/mirror: set .co for active-write MirrorOp objects Date: Sat, 3 Jul 2021 00:16:34 +0300 Message-Id: <20210702211636.228981-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210702211636.228981-1-vsementsov@virtuozzo.com> References: <20210702211636.228981-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.215] X-ClientProxiedBy: HE1PR02CA0112.eurprd02.prod.outlook.com (2603:10a6:7:29::41) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.215) by HE1PR02CA0112.eurprd02.prod.outlook.com (2603:10a6:7:29::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Fri, 2 Jul 2021 21:16:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1263cdf6-5361-4529-20cb-08d93d9eb668 X-MS-TrafficTypeDiagnostic: AM6PR08MB4691: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:283; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SxWzlAaGvRwWzzZblB4qKRFdBlGMBoiRHxcS6x5xJ4HCMNXklemVRZVcTZhCyF8LPxsKt84vWfTnqPxL8Tt/6WsK9IYvguGPFb9JfGZdxN9jtjUSkNeSWJLptZjjTTygx/XpHHlvSVA6o8FLD/Fmw5/n0YxUZ4hxtj5n7Gxjm2yQ7ag+GGVkxo1jyD7v71u2q/uJeWCYY0jjk4J9wRC7sHfQMoulscYAnbmBNLHrO7lQPkyHRqlGG4GzRKk/CfnlOa3eGLe6Wiky37FLjVIAqSQZ3iJWULhEMuK0Id9wpTIDih1JCpNO0JYtiPFw36F7z9xRWI/C+XKXtqcalSFW7vOMEJILjmp22F4aRQN6mMFghJbnKpP1BN1rxV3mPCy92stA5UgRlcI/3V5NMpzyGqyn0InxCd/h8BbszwSTz2LmTLIKZ3PnZx+nUVBb9lI7qCRaPEbC+QCTmyoxWRUd6w4w2YiE0Apaidsu9Hr8kkuDwfYox9qn5x6F3dyHI8x3YS2gdst9P8bvOQNZDTU5TgNTql2ekm4qO/3XOImAwmW6bDd+GBcbmh9rTB5ZP4fihPCrK/zTo13YPV6JxlE8ZCZSKb5Cki2RAIz/9pr3PtKQAcFRSA/4/Rvi3Uf7Ee9iOdLVV/eR2hx5KZE4cQ4PpIL18MWoNxvQniCN8D4Qbxy9qO7yGW2sK2SDdSrDFX4k0xJFPEGS4tQYC21nL2SuyYHogINODOBSUtJ5/IAtHGouss/+67g0p5zAGFymF/HRz15W19czg/tmX3ac+Ealvg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(396003)(39830400003)(376002)(346002)(1076003)(86362001)(316002)(2906002)(52116002)(4326008)(38350700002)(8676002)(66476007)(66556008)(5660300002)(38100700002)(66946007)(16526019)(956004)(6916009)(83380400001)(6666004)(107886003)(36756003)(6486002)(186003)(478600001)(26005)(4744005)(6512007)(6506007)(2616005)(8936002)(69590400013)(142923001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zH7HLvLkgcrsezhv1U12YBRPshcRoJ9OXhQOvJ042R7rMLFXpwvWHj7tfeAjGDoqzHqEgxKuepzgX3U6MlfGWl76288de3QCJlQHcAvf3SyCyrW1wL3y5q27hO4pB67bdbJ4Lxl94D7FEtD2zJTadEWnwquiIk/enHEe/I/J40WmmjHOfZ5qGDo6p1Qv1NBa/AWqYoo5LVPTTH7m4Q7Q5AN3CA5SfA40OvHSVLXvpgeWEQJdeFQD8zmfuUoDO848pc/EK7dzDbn7rOybu1cFW5flIImgtnsy4RtY0o07Ld8UCUTKhDtmQFURySXecD6I4yz5AmNdaqG/+PGgdE4RXnRMsQ2EN8lrnrqVqHLzUGj4uuJ0DrEW+APUzJ+aElNPnvU8vVHPAOOjIJYaF/gSVB7QjGWXCg4mSwNHVcam+KE7UlNDwNgJVgz36EBzduCU9xVi4fSQtAZY9eNUiTFUOk32qq03b2quBGQa7dCr/0Sz3G3fnMN0xUdEIsXSetd7+z7A38uKKTGG63OLba/1NqtU9jwF6a1P3Do2BMqTSuGHqusUQTra8J0Tjtp0yYxZJPjJv1rJFr/95l8PiE7pkBsxEhS7/SlAS0yhUtor9hIaVl4wO3BPKPUBbP/QafjHJODnjM+FsyD68bic8PPVVmPlcz9pSJ/U9vTI/akAWAILFp7x5lxwk5HZitOoStvHvYi3DMdw2OyqYoMynYgxhZZhHm59k9657vdmgZmuorw68zyu75Zk49rZtp9OKe/03OZZCFtciT6Rw2hyqnaHj6Xn/s3Fci45t7TlYcFmDnfBRzqrE+osIupdPMbkSu4BTXKYjyxr+mKebPBH/gA3Jd1y9G016n9ZdoY0+9rcYthlW5cTuUVwXBkWkonQrO5Sw9dHn68u2I754NUZsG/PJTxmIsC1BEY126dm0DEYMUngfIfgeuPxFAuRewXyNJteS/m6gMbDNA+Dz+Hf9TgJ+1CzJU13RaiR2NsHAJUZVGDSbvGgsG/9vXRVHi+Q0mlFUmfMtiLaaI4/dYxRiB8ilW0ljvsAvXC7FJ4l53gxnnQBTbv48ANjm+KV9icH7w04uwZwZZDW+A0qY/jTn4jaRlly2IjNfpixL/wiZUG6COxhEV5DXdu9k/ekXuh6Aai3LMPzTM0Pwc3CTU+59kbRUT171JrzuDQkSimi2/9XT6oQKLBq6ouo88KCmogKqZdhcqCE7G9Kg39tCs1qk29yisMT45t+TsVjtoRFflq1pTuswjisLLFFps8hVeemMk261jx2mpH4ECthINLWmCLBovdLIYPliH37jaiKu9OGVNRzuLIVm7wx7paD3/MAkSUX X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1263cdf6-5361-4529-20cb-08d93d9eb668 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2021 21:16:53.0302 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 237OqFyXmF/L1D0kQNXglnKH6SsMBDHVoL0zPHfXVL4FZVSbtck8uL6XVc/j5NmRpmGIABiQoJMhkawqQnmmsKRPGO4Dus7ABeZuWhE6dtw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4691 Received-SPF: pass client-ip=40.107.6.106; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This field is unused, but it very helpful for debugging. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/mirror.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/mirror.c b/block/mirror.c index 019f6deaa5..ad6aac2f95 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1343,6 +1343,7 @@ static MirrorOp *coroutine_fn active_write_prepare(MirrorBlockJob *s, .bytes = bytes, .is_active_write = true, .is_in_flight = true, + .co = qemu_coroutine_self(), }; qemu_co_queue_init(&op->waiting_requests); QTAILQ_INSERT_TAIL(&s->ops_in_flight, op, next); From patchwork Fri Jul 2 21:16:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12356523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16F91C07E95 for ; Fri, 2 Jul 2021 21:18:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A488613F5 for ; Fri, 2 Jul 2021 21:18:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A488613F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lzQYe-0003S0-VY for qemu-devel@archiver.kernel.org; Fri, 02 Jul 2021 17:18:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzQX3-0001Ix-Os; Fri, 02 Jul 2021 17:17:05 -0400 Received: from mail-eopbgr60106.outbound.protection.outlook.com ([40.107.6.106]:49763 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzQX1-0003iz-Rr; Fri, 02 Jul 2021 17:17:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bzUoSe3oUPxpSpGTSZBe9H11gkZn/+7AO0WQx9GAUkPxtmYz8qnMqC7Fn+kQaYIVl9YHTJ/44/6yuzfxw58OrZlGiZ0+zyrd/3dIHvbWVDkEkhsMiolnO51bkBdqcGjY2SVcIcSSftnfdtYJnNxDVMINVYesS3q7cuvgyYJA7gnVHd77Fk7/5m1Q5El5Uy7xfjmrPRXWaSiqT/1G2d+2nIX9RqyzR5cQ/6U88flkLOuQER/Es5u893/2EUzUHwzfV4NAPvs7FBU+VT05Si/4BwPMzt3SY8r1sem1DNOB3EdL66luLtGZE9EnR66hhIA459QAY9jmS0zYhwZnvOfPVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qZ03WrpLQc8hxWrOr26DrxKsbDTTDy6Pj+wrL78+T1o=; b=UwOeceBJAmDTyJCHnm7NNf1LWEieU9iU29wk8VboSaoJ9C8xGG4kohDo86sMWq+QPUrecGGX37iWHMWlSHQJvw4XiFcVOTn3RQNoF969WON+T/OZ1K0ikdN4eY8SNhSovnVmQTIK6fu/qLx0Hpsca04TuFrdaoln54RbD/EImlw3wCyOnPLqIsopbJVwNoxZDD8biqfUpJSjofagpBclq3i5CpMiDtXfI5zwHoaufs/sl5S7kkBsCo4bMj7PUzwmh1FQe5YgUdldaOD8QWAz6onmGhBM9NYXBTUNXYrAVK5MF3Ad9wpBiZEjxl4Ka317uOC5TT2d/04mx6naltbeYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qZ03WrpLQc8hxWrOr26DrxKsbDTTDy6Pj+wrL78+T1o=; b=B6EU8ZKLNJnUtvEEiWOp1udWX69QbclJwfB0b33YBDY1r+hOlD8GSlzh3UOEBSXSZbuVgznXFTSJJj5VBm3lhCga8efXNxl6+9XXz0hapVr05oEJ0wKJCFcWRqYS3iVE8vYgpt2Vy5eFuniGYE0+ka9On3M5diSmksn8kdQdtTc= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4691.eurprd08.prod.outlook.com (2603:10a6:20b:cc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 2 Jul 2021 21:16:54 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::75ce:1d52:cb60:e955]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::75ce:1d52:cb60:e955%6]) with mapi id 15.20.4264.026; Fri, 2 Jul 2021 21:16:54 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, dem@openvz.org Subject: [PATCH 2/3] iotest 151: add test-case that shows active mirror dead-lock Date: Sat, 3 Jul 2021 00:16:35 +0300 Message-Id: <20210702211636.228981-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210702211636.228981-1-vsementsov@virtuozzo.com> References: <20210702211636.228981-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.215] X-ClientProxiedBy: HE1PR02CA0112.eurprd02.prod.outlook.com (2603:10a6:7:29::41) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.215) by HE1PR02CA0112.eurprd02.prod.outlook.com (2603:10a6:7:29::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Fri, 2 Jul 2021 21:16:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fbbbadd-ae2f-40af-3d08-08d93d9eb752 X-MS-TrafficTypeDiagnostic: AM6PR08MB4691: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TC9wb/LvUF2X3gRDHk0oG7k7Q5At+1FJMJeVFztLtmHFanbZyI8ZkTcU2oE9PmhOTcT8bcAoFdaLVpqBShJDfQgVnZbOCGCIOjaShD+4o2XKDagfP6b5cMCSJaqKLi7o0wsh/EtLG1sRFcljVj2wk6xqS/uw06m6/RRaRnH3XBheQNfiUFeCwNFmYKinI+0p+it82oXHNN9i5MJhq9gYJpfyiQfxgLCA0nndB9RUhwwK+ptSjH03RchCm8Cn/+APdFK2sJtGC+hnj+qsvim9TxyC66iAN8OAczfgmrhe3KbRxgidtUckoQnotWkTF6k/uNTHOD5zm4o4hEIeXH42qsK/+1nMzVHW7kvIKhM5XrWgDB6fdM7R2hxnt3izaWElEDzzN7DjWTbYJxTGrP6btrsCrxD8mOiz7llK4vouHh0rV5S8bgW5wHBYSGksGlTNyFq+01O9DcaUquyz0GBRrGspIv3W/3UNH78IT4eCsC7+TPJouAHkHVYfhz9/jB4KszqXuaOUjrAMYHdaKBaEHOtJqRwCZaZPbYVAJk7/A2CUbeLN8k9kVh3Nh4+CCsaxDDVlqHYbh4jKTQuQW1OvmcmiNT0eudqW/0BOMEJpLMkk1rn3Mshec4B7NYGq2Sn9NT3YU0RnUbqC3u9R2GAjfuladolC+03agzzvUNHjpEa9bOz9msi4HOn0eUI9bOp4KFuzN3JQTVs9umhy5vcBg3VI0gR+CFnM1kNomaRWnINGHrBTInxhuGFgc8nO5/Ap X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(396003)(39830400003)(376002)(346002)(1076003)(86362001)(316002)(2906002)(52116002)(4326008)(38350700002)(8676002)(66476007)(66556008)(5660300002)(38100700002)(66946007)(16526019)(956004)(6916009)(83380400001)(6666004)(107886003)(36756003)(6486002)(186003)(478600001)(26005)(6512007)(6506007)(2616005)(8936002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yO876fTlJ2CT3YiWbX2CcNXLnaBAIOiEAC79rd3MRKEQ0eCM7LIrOjhBTfu/RdytqHUxD4IJ20NITnRSGakar1wEU80XPt/EB6nYLZQCJeF14HkLy0pMs1oC5JusNFlE0u3hxVNX/8NrBs5nJLRVNGFZXp11fbJPJC6mdkre/qarV1QTtRrRxRY1NO4znapbEq18JsOfbwzjAuyDM2KQGpkpQ/8KwUsMotsuXyCO1EqVsj4x4gr3m70eKMm3BoytUmXAU5zTF0klEUPhcML8+ef27vbNfWQ8wOlx7ZNDnwOpACIU3zfoG0Dy+6Yvn1PjnJDnenavHhG6aHlluDyMrGC+KECGdgGMNK8Z9oBZFMi+uBxNKQliqtoDV2w777ckxIT/tfN9cVVgve30R1uUQ2t5GrEx4bi65tFownJIKZEqrTRdDJO6HSuZiSt1Cy/kZcbQ0S0eTsavW6cOX5vGgxobqU9pWZJUE1a218bSHYJwaiNnGB+g855DUN35TEPRUdIHz10Nq9AE106Z2kdLrcZZ+BYgE/o66+NyR8lzFfxup0v5Pamc5E+wXmHBnEbnDkbUh058kXtDAOA1QO64Y4yF5mrB5Ii8+uekAfMhP6kC3UGNi0qUCE7F/BdbxxOwa3OZWI7ZnIUgqwZ3j0KQ2YJLssml1r4axQSvxCCPJQ3o/krvWGuX3mwPaSuUX5UVwyBile5U7GYrMExV6pLpadvNY+RRW5XXuiscJrS0FFJDOSOiban7pEgPalObf5hRRrHYEJT85MO7KQSevYPQro8klebDc+B8k+Tp0EceX/ZM2TPVxe+4hJRU1wOP98zlBfR/S6zdswF5FWqPUOr4NehS5L02KhvejYr4bRPe7RYFCvt1Pr3OXGzEm/PENLskgRWnnPQgT1L/6NZz18tPTuH2dTWnbxS1iya/+DLtQPMlMgSGfzeMtbK3Ui9ItpN9JckdI/w7jwnI0T0Sah/EN6ZO3sDEz8zVmnULkuQHEmvVaQ+EbaGXvQFyF+Cu3Hz6wcadhz8cabC7vQaCNhlQuoI9yu/fx8i4fP6BhAtIq0W2eJrtTGPvrd3HUwjaNs4PVTfYEQYOlnUbY3Yxb/zexqribX9PZlxwUh9L3cB+p68BsL8fGWLq4K+aCxxq/9CkD/LHC+/MwNksmxdNTb/4NnsEB/Km23OZGu8I8L4Kv2w/7piJkDLdMUtZtfKdmG8rMLj1e/ZsDikPbjNsA7vQdawCIruD8vpNblCsfUCjWbZ/9XOm3+wwfpq6tGnmjyRA6eg+YqrxfIw0ELaS25Obc50V+9GjF8ZzSfJSuEbEfaPf00XkzDXpDGgGe7fC69jd X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fbbbadd-ae2f-40af-3d08-08d93d9eb752 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2021 21:16:54.3246 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Vt7E8I5Wz4r00JG4K3dXh9ZPOLpc2YiM8fvEf2QxhIun8D9KGnqhiiQnY1S8HXusEl3cLSXkcFm++rmcCqnaaaa3VJ29PGr5rC5TXSmCeDE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4691 Received-SPF: pass client-ip=40.107.6.106; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" There is a dead-lock in active mirror: when we have parallel intersecting requests (note that non intersecting requests may be considered intersecting after aligning to mirror granularity), it may happen that request A waits request B in mirror_wait_on_conflicts() and request B waits for A. Look at the test for details. Test now dead-locks, that's why it's disabled. Next commit will fix mirror and enable the test. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/151 | 62 ++++++++++++++++++++++++++++++++++++-- tests/qemu-iotests/151.out | 4 +-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index 182f6b5321..ab46c5e8ba 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -38,8 +38,9 @@ class TestActiveMirror(iotests.QMPTestCase): 'if': 'none', 'node-name': 'source-node', 'driver': iotests.imgfmt, - 'file': {'driver': 'file', - 'filename': source_img}} + 'file': {'driver': 'blkdebug', + 'image': {'driver': 'file', + 'filename': source_img}}} blk_target = {'node-name': 'target-node', 'driver': iotests.imgfmt, @@ -141,6 +142,63 @@ class TestActiveMirror(iotests.QMPTestCase): self.potential_writes_in_flight = False + def testIntersectingActiveIO(self): + # FIXME: test-case is dead-locking. To reproduce dead-lock just drop + # this return statement + return + + # Fill the source image + result = self.vm.hmp_qemu_io('source', 'write -P 1 0 2M') + + # Start the block job (very slowly) + result = self.vm.qmp('blockdev-mirror', + job_id='mirror', + filter_node_name='mirror-node', + device='source-node', + target='target-node', + sync='full', + copy_mode='write-blocking', + speed=1) + + self.vm.hmp_qemu_io('source', 'break write_aio A') + self.vm.hmp_qemu_io('source', 'aio_write 0 1M') # 1 + self.vm.hmp_qemu_io('source', 'wait_break A') + self.vm.hmp_qemu_io('source', 'aio_write 0 2M') # 2 + self.vm.hmp_qemu_io('source', 'aio_write 0 2M') # 3 + + # Now 2 and 3 are in mirror_wait_on_conflicts, waiting for 1 + + self.vm.hmp_qemu_io('source', 'break write_aio B') + self.vm.hmp_qemu_io('source', 'aio_write 1M 2M') # 4 + self.vm.hmp_qemu_io('source', 'wait_break B') + + # 4 doesn't wait for 2 and 3, because they didn't yet set + # in_flight_bitmap. So, nothing prevents 4 to go except for our + # break-point B. + + self.vm.hmp_qemu_io('source', 'resume A') + + # Now we resumed 1, so 2 and 3 goes to the next iteration of while loop + # in mirror_wait_on_conflicts(). They don't exit, as bitmap is dirty + # due to request 4. And they start to wait: 2 wait for 3, 3 wait for 2 + # - DEAD LOCK. + # Note that it's important that we add request 4 at last: requests are + # appended to the list, so we are sure that 4 is last in the list, so 2 + # and 3 now waits for each other, not for 4. + + self.vm.hmp_qemu_io('source', 'resume B') + + # Resuming 4 doesn't help, 2 and 3 already dead-locked + # To check the dead-lock run: + # gdb -p $(pidof qemu-system-x86_64) -ex 'set $job=(MirrorBlockJob *)jobs.lh_first' -ex 'p *$job->ops_in_flight.tqh_first' -ex 'p *$job->ops_in_flight.tqh_first->next.tqe_next' + # You'll see two MirrorOp objects waiting on each other + + result = self.vm.qmp('block-job-set-speed', device='mirror', speed=0) + self.assert_qmp(result, 'return', {}) + self.complete_and_wait(drive='mirror') + + self.potential_writes_in_flight = False + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'raw'], diff --git a/tests/qemu-iotests/151.out b/tests/qemu-iotests/151.out index 8d7e996700..89968f35d7 100644 --- a/tests/qemu-iotests/151.out +++ b/tests/qemu-iotests/151.out @@ -1,5 +1,5 @@ -... +.... ---------------------------------------------------------------------- -Ran 3 tests +Ran 4 tests OK From patchwork Fri Jul 2 21:16:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12356529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF77AC07E95 for ; Fri, 2 Jul 2021 21:21:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 897F7613FA for ; Fri, 2 Jul 2021 21:21:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 897F7613FA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lzQat-0007yU-Nz for qemu-devel@archiver.kernel.org; Fri, 02 Jul 2021 17:21:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzQX6-0001O6-AE; Fri, 02 Jul 2021 17:17:08 -0400 Received: from mail-eopbgr60106.outbound.protection.outlook.com ([40.107.6.106]:49763 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzQX4-0003iz-DK; Fri, 02 Jul 2021 17:17:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tm10mBlIrheUgQnEg7GkacU7QEUt0WKQlnVjO3H0f7qXAer9dsPzZSQyq6MlId2RdgHeu2LPpT2oiutJXZgAHbOiNuQT72zLo1uCzp6hIfsLfkDf/ff7GjH27xxl4WoJinh4RIERDA+dF1VS36lCOGDjNQEFu8CopBbVk1nQJ5TTe1LOduTvPF8GhzeRy51PE0oHo0idHIyyQi4XGEFM8N34d/j0Bgqom/yBZ1+Q1vYqVeE/hW39Tqql4TvE21nl11npZn0sojk3nS0nsA9sT7EbUWCzOyXZGHNpBtxV1QL2LN4VFh9qtELugSPutsDslTMsrlvQU26QIpRjypvHBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LnQ3MLb4m/IpmNDawoA5xHvgWSnjbQNXpj3z3re3Z+o=; b=LuF8IG5RAH1wzcZaux+mtX683WRTzPFXgt11YrtxIOg51acoYGI2x5VbvCu5Y2KzdwUNyh+P5d7O3hD6FvipPuFrdr+9eohpxAuREsEAMFfPRW/oKrJpm+QZ9eQfQ0SwP1P+jzgCBP95YrFjueIuOEfJsrawnQeT/TZAyBmRR/W2N35LxKbDqx4mppsE6FO6KCYu2gdgreKqHm1XMUU9dnnDGnUhmVNj936kbNCcnZPnvwmmXMD1wsOwKM3XY3mbDsOTXNjejJdh5oVTLExbtYXiblQ5ON7OgeHBpZPIcErKQ/YLlNgNQRdUq2uVl0iNP5IzfohRPK+Doc0r0Jrlhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LnQ3MLb4m/IpmNDawoA5xHvgWSnjbQNXpj3z3re3Z+o=; b=jdEHnZZt8V5ji9ZDyOXpVKtVEGYNBNen6Y7n1AJkSITvZfhCsWCncvraSe3uoL876L4zv8ZJOWvxyZPxB76+ZpOqCvKjIAsrlzhz8ylm3OvS6InaT3IndoaN5Ua5/5gwH+iXAkY46T0KACD0Ht3EdU9mOcFCJcU45jo5FNWOPzE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB4691.eurprd08.prod.outlook.com (2603:10a6:20b:cc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 2 Jul 2021 21:16:55 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::75ce:1d52:cb60:e955]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::75ce:1d52:cb60:e955%6]) with mapi id 15.20.4264.026; Fri, 2 Jul 2021 21:16:55 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, dem@openvz.org Subject: [PATCH 3/3] block/mirror: fix active mirror dead-lock in mirror_wait_on_conflicts Date: Sat, 3 Jul 2021 00:16:36 +0300 Message-Id: <20210702211636.228981-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210702211636.228981-1-vsementsov@virtuozzo.com> References: <20210702211636.228981-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.215] X-ClientProxiedBy: HE1PR02CA0112.eurprd02.prod.outlook.com (2603:10a6:7:29::41) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.215) by HE1PR02CA0112.eurprd02.prod.outlook.com (2603:10a6:7:29::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Fri, 2 Jul 2021 21:16:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 24742fcc-b251-4019-757c-08d93d9eb821 X-MS-TrafficTypeDiagnostic: AM6PR08MB4691: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 22+7hlfHGVsysDYygm5jDUnrMxnqoeivlbiK/ti13Yw4ZE5jt1Rulnzavx01CuAh8oqisReMJ3lnMjLYIGkoolwtP9vRbkv9f4VRkKmWmwdg0YGHgap7xB3tSo+IeBfmBFy/byyvG/Zyb/F6v+IZwEMtBl9bo83Ut9EvmXvQj7Jhi7NwtWoBaCPiPWvXGoVnYYLIjvrujI2LjFSjM2CEy/WfrCpEK235p+Oys801JPkOd+ScYnpMRIssxxprgTuqmLSGTQPQBgBqC3pVBPU/TL27aOvVq/x14FzXU/J/75LY5Pl9589k5hlNPVeOMfVQ6/9h5POS7o8spQjSniUoOVBEG+ultxSD8vTjhJaBk2ORYooMXlRyjBAxnNAJD0bBnUCsQUO50/AViz6YKReUJRmnq/FP0YIENreITVX0hBrfY0n9VUrJJIq3Fdb2krp8JVBqseTp9ST5tyPegZ3zj8d3LaS0KVP10U4ECmYi77ukqWj+/NOkh8ThpFe8Z5U8pYHd4G7qbUmguibOR8UAb5dJ4aoDBYitDrnF+SYiKO5ndSotqVG7MxOe/VgXRZ4FJ1lFJTNPG+Kct4j2OdO+tz+B70tibX+TzFkoQftjSUJt31SXX/PUa0s/0vynt0mXWWIDcr7urKtb3kogGffFI0Cw/3tSpSGjgZYgHQLoGvLr5AgqCAHUzYz3GIQ+zf9PVS69AVoWTxoiiPpkPR5d/qwYNG385pff726wsjuPGetmJogJuToTubzBf3Cl3JSF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(396003)(39830400003)(376002)(346002)(1076003)(86362001)(316002)(2906002)(52116002)(4326008)(38350700002)(8676002)(66476007)(66556008)(5660300002)(38100700002)(66946007)(16526019)(956004)(6916009)(83380400001)(6666004)(107886003)(36756003)(6486002)(186003)(478600001)(26005)(6512007)(6506007)(2616005)(8936002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9/F1goRWEKPt80zvPfgmlhKVdbfQjCIhrOHAewxPedO8wvn+Cg6NJViwMwWogpKyXxPc0c5QIBvauCT12zYOySd433SP/oNer04jVGM6kbMfQ6xKSYajI6GCZl1dWroR/9zmVpbZst7RPnczh1WE1EYPG7QzHoNqIGe2hTJEWO6g+lcg+66ryOQ7zHo0s6YYA4h9YrK0bLbEZnmOAL++SF2x8co7xqzfntdPj6NUKakb6AaRlPz+BZ6/ywAu/TuBKwBGmYFCtIFKbry94P0NNedlhZ27WE8MuPk0LcTSnGccn+f/2OJAgBex5CRLMjCWhekc110ebqqETYO1YEv7xq2XI4NDC3SVaLBr6gC2236yNdGsqZpqDyFqBncLmsvLWWWpm+hFgnpINwMFmSanW1imSeGvxITsLe7tza0vq0csdZbNFVLXuPrG1Zhw7d8HGODeDhgUoR1sbS3tbgjiDopaTHZd/GagkUQB0aP/z1LFaMkr3sbAWgdWMslbfIBEh25ck6BZbciiC+uhgHbtwDVYmBtgeQcevWd18dQlqaHLAEOEHym5oUlS1LkBL/gsDn2+pT+8KmBefBxBOZ8fiCCSKljheoNYeSmxDtnyjgRa0w0IMlaMjw7tJ8/V4BQ/OIAqAbwVMGiSzcfqSrL0Otkw6t1yS2B60TOcq0xfhJm2zQFciy+0SV3pypEB0gfRCE5RhMIgUsCQkP19zd5pxCcbgle+paNzeRkKf5pybnWRhssfBBKiCXD4dLAmX/rlL6y3Xf1AHIWNSr95YNfSAebJ3THZ6l2N2LpE0mUxqofZYbyafPmyu5fI/RIiahBybJcyrlPXUuuhHycSLAQEMqwtKq+Cz0UhitjinLUJUSWIH+Gx6MhPG5gCpkNNOw2kPncv4BBmBEUBq67YMqEKoPksSvBi+JuhGmGgj3vMr31B+2fEKgiLd+gQ5LIe9Pl8ojYt4WeNJp7fl3hEBEjmkgjTyRAKZzCf/TTY6GeEVwMfyz5oxENWJzA0+uO1CpBZ82VinwezvF/qP8k34Axcs+h+OYixR0UdkPBl77QNb51WCKmdriUAvGzgQf4FufqXLOkUbDmjT1FEGRVZ2nhgc3lcPVX8IwYr75FlsLiP4nyT60CDdpBFJ7DcTEMVAXvwU3/ZcAA5vKh5wg50Rr8reVc6t9zmuwUKT0fLP1TFpKWF4DeIgcCZ/skZIlA4ILo8rOVfkMcWjB8XhWNCmoVeIljP49h4rxqmGD50CXo9VhWB3l6VY6yFhlfoc4yfmKfsQIznB8aVJB15dJ17q9JZQ67EnR7DVBPbuvaXss3CSyIA47CzQRD6mbwvHBBE3lNi X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24742fcc-b251-4019-757c-08d93d9eb821 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2021 21:16:55.5084 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: I/RPOXvlZWM/0KcfASGmB0anEW3TR1AzwaLfpNzL8vBy4XZksqYDPF4icbYBSEAWAHuVk8doD50Z1EcJi5U2VxGMSZ2Py9duwa+g1Kf116A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4691 Received-SPF: pass client-ip=40.107.6.106; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" It's possible that requests start to wait each other in mirror_wait_on_conflicts(). To avoid it let's use same technique as in block/io.c in bdrv_wait_serialising_requests_locked() / bdrv_find_conflicting_request(): don't wait on intersecting request if it is already waiting for some other request. For details of the dead-lock look at testIntersectingActiveIO() test-case which we actually fixing now. Fixes: d06107ade0ce74dc39739bac80de84b51ec18546 Signed-off-by: Vladimir Sementsov-Ogievskiy --- Note, that I failed to run the test on d06107ade0ce74d, that introduces active mirror. But it seems that the problem should exit in it too, and it's better to leave "Fixes:" tag than don't do it. block/mirror.c | 12 ++++++++++++ tests/qemu-iotests/151 | 18 +++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index ad6aac2f95..98fc66eabf 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -107,6 +107,7 @@ struct MirrorOp { bool is_in_flight; CoQueue waiting_requests; Coroutine *co; + MirrorOp *waiting_for_op; QTAILQ_ENTRY(MirrorOp) next; }; @@ -159,7 +160,18 @@ static void coroutine_fn mirror_wait_on_conflicts(MirrorOp *self, if (ranges_overlap(self_start_chunk, self_nb_chunks, op_start_chunk, op_nb_chunks)) { + /* + * If the operation is already (indirectly) waiting for us, or + * will wait for us as soon as it wakes up, then just go on + * (instead of producing a deadlock in the former case). + */ + if (op->waiting_for_op) { + continue; + } + + self->waiting_for_op = op; qemu_co_queue_wait(&op->waiting_requests, NULL); + self->waiting_for_op = NULL; break; } } diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index ab46c5e8ba..93d14193d0 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -143,10 +143,6 @@ class TestActiveMirror(iotests.QMPTestCase): self.potential_writes_in_flight = False def testIntersectingActiveIO(self): - # FIXME: test-case is dead-locking. To reproduce dead-lock just drop - # this return statement - return - # Fill the source image result = self.vm.hmp_qemu_io('source', 'write -P 1 0 2M') @@ -180,18 +176,14 @@ class TestActiveMirror(iotests.QMPTestCase): # Now we resumed 1, so 2 and 3 goes to the next iteration of while loop # in mirror_wait_on_conflicts(). They don't exit, as bitmap is dirty - # due to request 4. And they start to wait: 2 wait for 3, 3 wait for 2 - # - DEAD LOCK. - # Note that it's important that we add request 4 at last: requests are - # appended to the list, so we are sure that 4 is last in the list, so 2 - # and 3 now waits for each other, not for 4. + # due to request 4. + # In the past at that point 2 and 3 would wait for each other producing + # a dead-lock. Now this is fixed and they will wait for request 4. self.vm.hmp_qemu_io('source', 'resume B') - # Resuming 4 doesn't help, 2 and 3 already dead-locked - # To check the dead-lock run: - # gdb -p $(pidof qemu-system-x86_64) -ex 'set $job=(MirrorBlockJob *)jobs.lh_first' -ex 'p *$job->ops_in_flight.tqh_first' -ex 'p *$job->ops_in_flight.tqh_first->next.tqe_next' - # You'll see two MirrorOp objects waiting on each other + # After resuming 4, one of 2 and 3 goes first and set in_flight_bitmap, + # so the other will wait for it. result = self.vm.qmp('block-job-set-speed', device='mirror', speed=0) self.assert_qmp(result, 'return', {})