Received: from eggs.gnu.org ([2001:4830:134:3::10]:48841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC54R-0000nH-6x for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:55:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC54K-0003fE-Sr for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:55:50 -0400 Received: from indium.canonical.com ([91.189.90.7]:45034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC54K-0003f6-NN for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:55:44 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1XC54J-0007wz-PJ for ; Tue, 29 Jul 2014 10:55:43 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id AFD922E80BB for ; Tue, 29 Jul 2014 10:55:43 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 29 Jul 2014 10:50:08 -0000 From: Stefan Hajnoczi <1343827@bugs.launchpad.net> Sender: bounces@canonical.com References: <20140718061500.9209.75334.malonedeb@gac.canonical.com> Message-Id: <20140729105008.4298.85100.malone@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1343827] Re: block.c: multiwrite_merge() truncates overlapping requests Reply-To: Bug 1343827 <1343827@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Thanks for reporting this bug. I'm writing a test case and fix, will CC you on the patches. Please keep in mind that no ordering is guaranteed between requests that are in-flight at the same time. Therefore it is unusual to submit overlapping requests and could indicate a bug in the application. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1343827 Title: block.c: multiwrite_merge() truncates overlapping requests Status in QEMU: New Bug description: If the list of requests passed to multiwrite_merge() contains two requests where the first is for a range of sectors that is a strict subset of the second's, the second request is truncated to end where the first starts, so the second half of the second request is lost. This is easy to reproduce by running fio against a virtio-blk device running on qemu 2.1.0-rc1 with the below fio script. At least with fio 2.0.13, the randwrite pass will issue overlapping bios to the block driver, which the kernel is happy to pass along to qemu: [global] randrepeat=3D0 ioengine=3Dlibaio iodepth=3D64 direct=3D1 size=3D1M numjobs=3D1 verify_fatal=3D1 verify_dump=3D1 filename=3D$dev [seqwrite] blocksize_range=3D4k-1M rw=3Dwrite verify=3Dcrc32c-intel [randwrite] stonewall blocksize_range=3D4k-1M rw=3Drandwrite verify=3Dmeta Here is a naive fix for the problem that simply avoids merging problematic requests. I guess a better solution would be to redo qemu_iovec_concat() to do the right thing. diff -ur old/qemu-2.1.0-rc2/block.c qemu-2.1.0-rc2/block.c --- old/qemu-2.1.0-rc2/block.c 2014-07-15 14:49:14.000000000 -0700 +++ qemu-2.1.0-rc2/block.c 2014-07-17 23:03:14.224169741 -0700 @@ -4460,7 +4460,9 @@ int64_t oldreq_last =3D reqs[outidx].sector + reqs[outidx].nb_se= ctors; = // Handle exactly sequential writes and overlapping writes. - if (reqs[i].sector <=3D oldreq_last) { + // If this request ends before the previous one, don't merge. + if (reqs[i].sector <=3D oldreq_last && + reqs[i].sector + reqs[i].nb_sectors >=3D oldreq_last) { merge =3D 1; } To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1343827/+subscriptions