From patchwork Mon Apr 24 20:13:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 9697333 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 C9D01603F2 for ; Mon, 24 Apr 2017 22:46:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5DEE26223 for ; Mon, 24 Apr 2017 22:46:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87CFA28415; Mon, 24 Apr 2017 22:46:30 +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.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 B3DDD26223 for ; Mon, 24 Apr 2017 22:46:29 +0000 (UTC) Received: from localhost ([::1]:46237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2mkX-0000qK-1F for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Apr 2017 18:46:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2mjn-0000l5-Ds for qemu-devel@nongnu.org; Mon, 24 Apr 2017 18:45:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2mjm-0003rs-8N for qemu-devel@nongnu.org; Mon, 24 Apr 2017 18:45:43 -0400 Received: from mail-db5eur01on0118.outbound.protection.outlook.com ([104.47.2.118]:55521 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2mjc-0003qm-DI; Mon, 24 Apr 2017 18:45:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7GW1ecCETc6SKr7EaNJOzKF4cVeOZ7QiCRjP+hb/cws=; b=Mqd7IXjRKgpYthev+5CkqR8GnUQZ47xk5kLfowSnLxFYRivnanO520Vzhr0Lp16eUlkBANzrtK37H6niHGAa/7onho2Dqb2099oHij+V0R86Wqzn0wvMD/X0wt1UYw8DsGhEYEYGjwC0YmuyzWW/aaepRRSuitMsjggw4GlsN1w= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from [192.168.0.138] (109.252.107.80) by AM5PR0801MB1986.eurprd08.prod.outlook.com (10.168.158.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Mon, 24 Apr 2017 20:13:07 +0000 To: Peter Lieven References: <1492769076-64466-1-git-send-email-anton.nefedov@virtuozzo.com> <98514b87-d2a3-254d-f03e-0c6d3cd73ff6@kamp.de> <88259101-7040-f057-5ed4-76bd36f2b1a0@virtuozzo.com> <15b32f67-fbce-fe9e-5a5f-ed25eae49941@virtuozzo.com> From: Anton Nefedov Message-ID: <59ebc5d3-5921-9d3c-1436-caecd1e23a60@virtuozzo.com> Date: Mon, 24 Apr 2017 23:13:05 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [109.252.107.80] X-ClientProxiedBy: HE1PR0601CA0032.eurprd06.prod.outlook.com (10.166.117.42) To AM5PR0801MB1986.eurprd08.prod.outlook.com (10.168.158.13) X-MS-Office365-Filtering-Correlation-Id: 109213aa-6374-434a-d8ae-08d48b4e52de X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:AM5PR0801MB1986; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1986; 3:XpCFjeCtC2rWnbxqwGEsb4qw6Sg1yb1hmdFo9ihifcezJF6Tq5xFb2l4wj57VwPpXWswfrsC6Yq8f55fFqytXp4vJPYaUhoShDrbcCo+RgkH5LGRI97BOWWpiSrlm7fxKhCwHWIyiwICIY6J/lpXZQV2B8TK7RK5/f3g60/vN86wtWzLGsxOY1qIY5BBbGAdbarLa0CsgdwpsX03snMDj9BTlTygsssZboJMsuQyAwDIXbRNc4srzq0E7vnb5iZ2/jN4eavXQ590M0SU3JT9zguRIlphGA/PWq+K1PZmV3WHSICAD5r92iyujAS0aDj2hXDrhCIV+yNub2+4SXkX2A==; 25:Rb3Ujvk2NqHIG41Z2mcw4M7Zf5sXqYsB5NxKcdbkWi6NbSa2+zTcRmHpW3kCC4mGOM2H0+wxIXBidGrrSNnP65a5SSsbM6PTZuSJZmUNZcy9ROWvtZIqUebvyRcqjgTdc5up1Qfz8h7PW9XUhzMqGJjTdUbJv1H7GnnTsoIyyDo6SUZuE6Knq9+Sfg/slAarTOITvw7l/g/+bB9EEujIM1KpSDSJbfMs5Ni9ABggRcE13FvUUTq4YQwuf+ICL7NZJTaiaNyKOjrwGyz9ZaHU1faX1DlJOJ9GOtrGAgun0kq9dgltw/UB2vUzP3ByoOVTC1z85Jdst2f7VJ3H45d9OX6VEmaNQA8kj6UW6JbJk4AkZ0/XVaHMsm5drWeKty+CPjwfS/pSZZNUu2QgJ9t571G6zawOB89nk2SBcjxDh8mlbuQXTwZoNQeOA7BNcfc9H6rSZacin8Xu/lZr4BvKcA== X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1986; 31:xd4HwE+T8WN5T2XkcZwUT7WCIIMV4Z+G+v+aKgGs+Gd9HjUhTBMDkNr3GCZzuDLarTYcRSoBzU/j75FoFf6uwKlWVVXpaYd40nmWYAqbq5uj1/Q8JYwCipV/8zicgu2+OZz5ChgNP6UUot9+T6v7rxzSg5e/gymqk3/adodQ3qrvgUoOA67CFN2fuRf21tr56pcyGgMuFCsOQSs+54Ru/arKgP/XFuve4ACHpdN5uEgwMvo5ZU+OudyHYr744yZw; 20:MNBhKRx9E03YJTzi7jmjH6rSwYNR2DJiAcUznbBUxMfibM1DV4brV9TLlz6hX2KhlBOMNQSsvHTN17Y63LCj0683XAYE17hdZxGYUx0Q9Xq/wCgv+eAv7ZILdjhzf1vZRX6YWqh0MM39TEygbzfGlY3naIZJxSq7VVusrvPzPG+90bhgrIq6Vf5lh0HO13xzHeGZgnk4Z/e9hYl+PVM/dBu0VDmW8IfgB2qh/OZsr2J4SWVa8+bnzTXWpqDOKfMMAGDWkzsw48ItSFd4hnBkVnVlm3eMLyb54b7P3CLY1ifugvTgj5zAxVzUm9q613KovM9LqRoOPZRfTxb7rckOLrh9K6txyfe/6ZaWk5c+vgiMEUGJ5lDytZfYmJLA6PDB1Vt2RietwAirKuajEFcdI0w3IXI28V265yGaRL16bCQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:AM5PR0801MB1986; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1986; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1986; 4:bdRR0pJNVjSegm/yYK21EL7TXWfFwwXRPTuVGJLAJ+XTr6sCNwCf2nOHlfp0YthnaXnwAmVAEcVPy9KTAcSb/7p3/N2rKZyOnruK58csmJ9rAoN8I1ZKEt2nJhBZwfMrQMXaMSTYcgXthsWKiAwq6jiQi3mYkRnIML+lYfPgwarVZ+54wdIUVI2/qWhgO6G/VbBMnv7/Pch/vmwChx/oAojNL1tjWfBqZTn+qn0mzdMrqXhDmjPrQEJMit9FsUbKWSeS3m7Uev1ck3DlI+NhNRAa2+fer5XkDRfEMs2ciDnpV+yJrA18LVz7TA6+941BIxkIQayNXTE7TSUi6HQY6RCJ/RshOXt1tZLnElHP3AgxynTOIVvMur6YxyV2AwWJ2JB6myQwifsFuSjUncWYH50kfiw0b8LaiDaUIfSG4ouF3/6hznRBtSMH9TQWHIpFoeecMbX7rCYVQxSn4FOxJnf8flPmJoONzbUeRn+Xb+DF18VtKZKbFqZtddwzubJB30/yXXb2nMDdZRL4bZBM7cNVDuAHB4eWJ3s5GuNNVYDZNXzLQkIZOUYRGd67jurcndJsxEqz+dfIOoNsad9B50PpLXQsK6UovWZxPnyKZg86fch4NpDUobcJ5T4JUp5bpPgOPTugSjGV31Y3ze0ugkZkEPqZUlEeECFdGsuzYwLPIK1hScb6rg2to/9Ksyp3n3653wuRVW8G7H3lkY212A== X-Forefront-PRVS: 0287BBA78D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6049001)(6009001)(39410400002)(39400400002)(39840400002)(377454003)(24454002)(93886004)(575784001)(8676002)(81166006)(83506001)(6916009)(4326008)(86362001)(5660300001)(229853002)(2950100002)(2906002)(110136004)(38730400002)(31696002)(53936002)(25786009)(117156002)(54356999)(50986999)(66066001)(76176999)(47776003)(54906002)(65956001)(189998001)(3846002)(53546009)(4001350100001)(36756003)(6116002)(42186005)(31686004)(23746002)(77096006)(7736002)(33646002)(6246003)(305945005)(6486002)(64126003)(50466002)(230700001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1986; H:[192.168.0.138]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; AM5PR0801MB1986; 23:g7cq65F2eLvIsTDv7sR7H8Zqdjv8n1OObLU?= =?Windows-1252?Q?FjQFrnlIK8WpwptoDqjeRHyE81St7+gf0k05mfdznTV6Y8Yd0ugjtTBw?= =?Windows-1252?Q?K7l1dcPVqNd/a2ln57IXGM+qf6BFvv+UEPuTO4VoR1KzpESG7oBoxxEK?= =?Windows-1252?Q?MLIdiDrnTF7a0PwvbXK4gIn94TECV+SksZ8ktIeQ3EGBBbsLkqkcDnNQ?= =?Windows-1252?Q?xvJ7peWoWGentovTkVNA9Hz8SlWX9UZ8eCDCixRUn2MFNlykyGlPyDgo?= =?Windows-1252?Q?2xvmmhrLev/Z0XcXR4ehBCwNLlx8BKrN1BT0OTBnXd9SDMGZgqPPsyP8?= =?Windows-1252?Q?5X79aIJ5K1Dl4huozNPgwXZvqlDeMe1GMJGU8iVfyU3VE8AhjXvdnsR8?= =?Windows-1252?Q?TC56Ftf2gXehLuzxwYjSfo13do7PRVT9DlUGUTtDn0tI52SBir4QPMeD?= =?Windows-1252?Q?X3jkDc4MKn+fOSPo3OBY+zywrOjZlPoO18Q6QmAzAGMEhAaBTpf51TeW?= =?Windows-1252?Q?Zexr0g+u9QzmjSn1w29t6P/Ekcw6CWf0mvi45oW9xILOodQVbQOxQ6OT?= =?Windows-1252?Q?QFjwiuw1S15O4OfnELifFsJFUMCWq5ucx1bUb0BkwSHlNxC9rHo4aVQW?= =?Windows-1252?Q?XyMQeQjYaNNMYtjd+CYvezy/QeWRj2j5IpXG0Seux/LXVQAOXkBl4fMv?= =?Windows-1252?Q?rZEcfhRyzpWKh7PultFrXogUuOnp6SjeLJS9CeyfXkpzbtNgR3TOXw8V?= =?Windows-1252?Q?U9+XzmRQmQ6prLxJsgpHfM83kgUB6OvxzAL4yslOoTNUCsF+yfv+ipXz?= =?Windows-1252?Q?fAAJB/ozhMgc06NY/sV1zLri+B9SFzIPJc8t15Cug8FCTAKuhEDaoC/y?= =?Windows-1252?Q?Hk38ZZ5KlFe6kBnVKkQ1a9G81Nvn2uOmoS6TXkfKp7ELOCfkEFrsDZkN?= =?Windows-1252?Q?84sbeSA/ry1oB8UyAkCPkGjDoBxnRW/PDzo+j6yQgoBWqdIITC4MVY0X?= =?Windows-1252?Q?NgPJDNpFJkSDz4+i+XRLWMsjLK6axXreJ4nMZE2n6vFQ2kPtvsuaOrPd?= =?Windows-1252?Q?g2Klpimck1BB3N3Xwfft2yWoFmumTgcCYLS/rcYjL8KHI5OFYA2yIcRK?= =?Windows-1252?Q?9KuUxkc8Na1K4NY2e6ZziUAIE+02U+F8AfM4BwNvgJY4v7ohnNmu5yTL?= =?Windows-1252?Q?YWKhmSVqMaokRo7ndVFCpQ9c1QmbgkKaGplf+e+/i296qTEtmZxWUFpm?= =?Windows-1252?Q?OIsiB3j5xhXflNrOwbQv0EMVK7u9RoJdxE540KCpnkT16x4Fxrfadt+Y?= =?Windows-1252?Q?1Pfi4V+qNQfCuRfn9a059xL1qLsMzt7+bSXgWejjynwxuk1k=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1986; 6:BEnYV0uN4FadJiFT3yrxVKenEYrs9x8mo5voBRM1I+tL4/IwUfTwcf7y19RmAh8Ibu0WLCVfmlhFtXtqZ0f5A17HvHZ4Ei68MKEn+bcjMEJqbPzeIIHoTufkM3NAFkAAVIRPsOA5UOwjvD06YvbywpKDe4eaCMmn7tvUW8DRKp40ddqD17wLpbhfoi1zMNzPOoAh8ulLRLzO4hLPybNBrXED6/rInKbtxreRl854NX83a9EkO5VVAjOHeBqMB9uBtvw0jak9N66s1auHbvL360ai6kRF8P4mgtj1QIScZ8PUqvp4hkztOmZj4+XhIvukJg8V5R2OfZe6M02u+0cHJbukb77Ugz7welcfAp0OOWv8ZbP+p4irfFfskH36bxmUXegaOac7UdCQr70LyE8/zkBO9P9pTyAj61xJUS3xsqCaeX6EwPxjLTFvs5bJ8eva+2OPhdhzV2c1HHgANMpOcoGMZNA6HVoTQ9kYmwXhioO9+ujB4ZbV8AaOP5gQJbvdHIkOO1hKQ13gPkz+J1xACw==; 5:AYOzXk0OeCYpB+TpoY6vKbr2+oOpTty2weoGujyGAIGuN7/y8H/uz0uJE0EIJsrDtMs+dXa2Obd12Ws72vaxXJ47PqlsZwiGN/V8QyiFiiZgpl3EYtS4pW6aWaBB/QSuDiZTjFbsZ6h8MsXhs15Flw==; 24:0W9kbnyse77gZ3whDYsdi8G9WlZErtvViTO89r5gERzo2F4gKh/JXrYFvgNqCBhx44a8V+GWpr9MekhXNXXOAWJbxjXUeVU134r+/D8bf0I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1986; 7:7ydFZ/2+bZQnn0VKMTZTA1SkBUgaiUv/H8t6o5D0LnehvRleh+tpH9qPQZrnqD+5fa812cevwsXELItiZ83KgRXC463xz4k6wXP6e79Q9MU+Zfp6D3vnuEBH+uXosFjHZvSZwxPPM4IyKUFWAx93YfHV4gfYLTOPyCBma1GaRWZytaS/xzCUQrQCXlJ23xkfBTV8Og+XzbW4finxskFjcvuTuEvhpte1bIRPGborxhsJv95PFMhV/KkkJNBSvIIOcl2NhAhIHVeNBFa+xTO/qrcqNuVS27e5mbavj4uZed9LbAJnZHgiqBI62F8e+v9BTXfOeI6LcRiF6+d9Q4JTHg==; 20:D1QFfOYrClQZJdHmxYpIdvDREtE0DFQoI/gT6GgM6FUF4s9r946EzbJLT7MJY525b7Z4eDApwqXSbLLGMML8wFQuITHJQExBxB3yxHRrZG9bgWseSVPO5z2nQNqVl+A/JXOo45KmowCnZy1aMqOMUH5sFbyhi5f0MNqxmLBG8U0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2017 20:13:07.1941 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1986 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.118 Subject: Re: [Qemu-devel] [Qemu-stable] [PATCH v2 1/1] qemu-img: wait for convert coroutines to complete 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: kwolf@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, qemu-stable@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 24/04/2017 21:16, Peter Lieven wrote: > > >> Am 24.04.2017 um 18:27 schrieb Anton Nefedov : >> >>> On 04/21/2017 03:37 PM, Peter Lieven wrote: >>>> Am 21.04.2017 um 14:19 schrieb Anton Nefedov: >>>>> On 04/21/2017 01:44 PM, Peter Lieven wrote: >>>>>> Am 21.04.2017 um 12:04 schrieb Anton Nefedov: >>>>>> On error path (like i/o error in one of the coroutines), it's required to >>>>>> - wait for coroutines completion before cleaning the common structures >>>>>> - reenter dependent coroutines so they ever finish >>>>>> >>>>>> Introduced in 2d9187bc65. >>>>>> >>>>>> Signed-off-by: Anton Nefedov >>>>>> --- >>>>>> [..] >>>>>> >>>>> >>>>> >>>>> And what if we error out in the read path? Wouldn't be something like this easier? >>>>> >>>>> >>>>> diff --git a/qemu-img.c b/qemu-img.c >>>>> index 22f559a..4ff1085 100644 >>>>> --- a/qemu-img.c >>>>> +++ b/qemu-img.c >>>>> @@ -1903,6 +1903,16 @@ static int convert_do_copy(ImgConvertState *s) >>>>> main_loop_wait(false); >>>>> } >>>>> >>>>> + /* on error path we need to enter all coroutines that are still >>>>> + * running before cleaning up common structures */ >>>>> + if (s->ret) { >>>>> + for (i = 0; i < s->num_coroutines; i++) { >>>>> + if (s->co[i]) { >>>>> + qemu_coroutine_enter(s->co[i]); >>>>> + } >>>>> + } >>>>> + } >>>>> + >>>>> if (s->compressed && !s->ret) { >>>>> /* signal EOF to align */ >>>>> ret = blk_pwrite_compressed(s->target, 0, NULL, 0); >>>>> >>>>> >>>>> Peter >>>>> >>>> >>>> seemed a bit too daring to me to re-enter every coroutine potentially including the ones that yielded waiting for I/O completion. >>>> If that's ok - that is for sure easier :) >>> >>> I think we should enter every coroutine that is still running and have it terminate correctly. It was my mistake that I have not >>> done this in the original patch. Can you check if the above fixes your test cases that triggered the bug? >>> >> >> hi, sorry I'm late with the answer >> >> this segfaults in bdrv_close(). Looks like it tries to finish some i/o which coroutine we have already entered and terminated? >> >> (gdb) run >> Starting program: /vz/anefedov/qemu-build/us/./qemu-img convert -O qcow2 ./harddisk.hdd.c ./harddisk.hdd >> [Thread debugging using libthread_db enabled] >> Using host libthread_db library "/lib64/libthread_db.so.1". >> [New Thread 0x7fffeac2d700 (LWP 436020)] >> [New Thread 0x7fffe4ed6700 (LWP 436021)] >> qemu-img: error while reading sector 20480: Input/output error >> qemu-img: error while writing sector 19712: Operation now in progress >> >> Program received signal SIGSEGV, Segmentation fault. >> aio_co_wake (co=0x0) at /mnt/code/us-qemu/util/async.c:454 >> 454 ctx = atomic_read(&co->ctx); >> (gdb) bt >> #0 aio_co_wake (co=0x0) at /mnt/code/us-qemu/util/async.c:454 >> /* [Anton]: thread_pool_co_cb () here */ >> #1 0x0000555555634629 in thread_pool_completion_bh (opaque=0x555555cfe020) at /mnt/code/us-qemu/util/thread-pool.c:189 >> #2 0x0000555555633b31 in aio_bh_call (bh=0x555555cfe0f0) at /mnt/code/us-qemu/util/async.c:90 >> #3 aio_bh_poll (ctx=ctx@entry=0x555555cee6d0) at /mnt/code/us-qemu/util/async.c:118 >> #4 0x0000555555636f14 in aio_poll (ctx=ctx@entry=0x555555cee6d0, blocking=) at /mnt/code/us-qemu/util/aio-posix.c:682 >> #5 0x00005555555c52d4 in bdrv_drain_recurse (bs=bs@entry=0x555555d22560) at /mnt/code/us-qemu/block/io.c:164 >> #6 0x00005555555c5aed in bdrv_drained_begin (bs=bs@entry=0x555555d22560) at /mnt/code/us-qemu/block/io.c:248 >> #7 0x0000555555581443 in bdrv_close (bs=0x555555d22560) at /mnt/code/us-qemu/block.c:2909 >> #8 bdrv_delete (bs=0x555555d22560) at /mnt/code/us-qemu/block.c:3100 >> #9 bdrv_unref (bs=0x555555d22560) at /mnt/code/us-qemu/block.c:4087 >> #10 0x00005555555baf44 in blk_remove_bs (blk=blk@entry=0x555555d22380) at /mnt/code/us-qemu/block/block-backend.c:552 >> #11 0x00005555555bb173 in blk_delete (blk=0x555555d22380) at /mnt/code/us-qemu/block/block-backend.c:238 >> #12 blk_unref (blk=blk@entry=0x555555d22380) at /mnt/code/us-qemu/block/block-backend.c:282 >> #13 0x000055555557a22c in img_convert (argc=, argv=) at /mnt/code/us-qemu/qemu-img.c:2359 >> #14 0x0000555555574189 in main (argc=5, argv=0x7fffffffe4a0) at /mnt/code/us-qemu/qemu-img.c:4464 >> >> >>> Peter >>> >> >> /Anton >> > > it seems that this is a bit tricky, can you share how your test case works? > > thanks, > peter > how I tested today was basically ": %s", sector_num, strerror(-ret)); diff --git a/qemu-img.c b/qemu-img.c index 4425aaa..3d2d506 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1788,6 +1788,10 @@ static void coroutine_fn convert_co_do_copy(void *opaque) if (status == BLK_DATA) { ret = convert_co_read(s, sector_num, n, buf); + const uint64_t fsector = 10*1024*1024/512; + if (sector_num <= fsector && fsector < sector_num+n) { + ret = -EIO; + } if (ret < 0) { error_report("error while reading sector %" PRId64