From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 832D9C43334 for ; Wed, 29 Jun 2022 00:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbiF2AgA (ORCPT ); Tue, 28 Jun 2022 20:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiF2Af7 (ORCPT ); Tue, 28 Jun 2022 20:35:59 -0400 Received: from gw2.atmark-techno.com (gw2.atmark-techno.com [35.74.137.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E25130547 for ; Tue, 28 Jun 2022 17:35:58 -0700 (PDT) Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by gw2.atmark-techno.com (Postfix) with ESMTPS id C609C20D57 for ; Wed, 29 Jun 2022 09:35:57 +0900 (JST) Received: by mail-pg1-f198.google.com with SMTP id a185-20020a6390c2000000b0040cb1cddf13so7376980pge.19 for ; Tue, 28 Jun 2022 17:35:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:in-reply-to; bh=sg/FIMb0Y22XOeDUVyJPVEEncgDb3cHZBiniEEmzce0=; b=riZGX8J2HeJgeyDdUccQVwmvm75w9NqKShU2NmOQm14y8y9KQdwTyvVGzPZtDFps5f AQJhcsgkZe2neagdZYnEHh1HS9HNHznOMUBgBzsZQ8VEGyImjCblpCsCrbrgbnck/aPl +bB5Bl1ET0ihWti4wHil25jgA/GUgfhn79Mn70l+ygMJUPwRleIIGat5Eo1PBrDETixd ygnpUkwX+50MDfe9v233WceqnHY7Q/wyRt42yJ+SEEUimhj4ZR8307PYSuQqNF6dlr0b TMPcoZtQVqQp15+4E4REIvhqqA3VL/cm/IcCRADIySzBI5PlDwXBiHuAaKWy1Pb/1CX1 1UEg== X-Gm-Message-State: AJIora+PkLEe++hQeeqJ256yE+T9TYiXPdJVfWtsH4Q1YqyDflcQlbwH Ez5qoozWjlRV6+IV1lgFv5dl39QqXzYaJi6VWcQAci5j20T0vuZyYwBsXCK4kQg4ohUAhXHxqfA YvgElJpJlHLx+OyeS+qLpEb9D X-Received: by 2002:a17:903:41cd:b0:16b:880a:8757 with SMTP id u13-20020a17090341cd00b0016b880a8757mr6398834ple.93.1656462956879; Tue, 28 Jun 2022 17:35:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vCGtD4SY7W6GWH0/Kvp3LVt2NcY4okLANBHyVAh9pXB99m07Os1CgwttUHJ0gmPk+RIDarEA== X-Received: by 2002:a17:903:41cd:b0:16b:880a:8757 with SMTP id u13-20020a17090341cd00b0016b880a8757mr6398820ple.93.1656462956611; Tue, 28 Jun 2022 17:35:56 -0700 (PDT) Received: from pc-zest.atmarktech (76.125.194.35.bc.googleusercontent.com. [35.194.125.76]) by smtp.gmail.com with ESMTPSA id a4-20020a62bd04000000b00525714c3e07sm10006096pff.48.2022.06.28.17.35.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2022 17:35:56 -0700 (PDT) Received: from martinet by pc-zest.atmarktech with local (Exim 4.95) (envelope-from ) id 1o6LgQ-007pyp-TN; Wed, 29 Jun 2022 09:35:54 +0900 Date: Wed, 29 Jun 2022 09:35:44 +0900 From: Dominique MARTINET To: Nikolay Borisov , Jens Axboe Cc: io-uring@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: Re: read corruption with qemu master io_uring engine / linux master / btrfs(?) Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <33cd0f9a-cdb1-1018-ebb0-89222cb1c759@kernel.dk> Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Thanks for the replies. Nikolay Borisov wrote on Tue, Jun 28, 2022 at 10:03:20PM +0300: > > qemu-system-x86_64 -drive file=qemu/atde-test,if=none,id=hd0,format=raw,cache=none,aio=io_uring \ > > -device virtio-blk-pci,drive=hd0 -m 8G -smp 4 -serial mon:stdio -enable-kvm > > So cache=none means O_DIRECT and using io_uring. This really sounds similar > to: > > ca93e44bfb5fd7996b76f0f544999171f647f93b That looks close, yes... > This commit got merged into v5.17 so you shouldn't be seeing it on 5.17 and > onwards. > > > > > > > Perhaps at this point it might be simpler to just try to take qemu out > > of the equation and issue many parallel reads to different offsets > > (overlapping?) of a large file in a similar way qemu io_uring engine > > does and check their contents? > > Care to run the sample program in the aforementioned commit and verify it's > not failing But unfortunately it seems like it is properly fixed on my machines: --- io_uring read result for file foo: cqe->res == 8192 (expected 8192) memcmp(read_buf, write_buf) == 0 (expected 0) --- Nikolay Borisov wrote on Tue, Jun 28, 2022 at 10:05:39PM +0300: > Alternatively change cache=none (O_DIRECT) to cache=writeback (ordinary > buffered writeback path) that way we'll know if it's related to the > iomap-based O_DIRECT code in btrfs. Good idea; I can confirm this doesn't reproduce without cache=none, so O_DIRECT probably is another requirement here (probably because I haven't been able to reproduce on a freshly created fs either, so not being able to reproducing in a few tries is no guarantee...) Jens Axboe wrote on Tue, Jun 28, 2022 at 01:12:54PM -0600: > Not sure what's going on here, but I use qemu with io_uring many times > each day and haven't seen anything odd. This is on ext4 and xfs however, > I haven't used btrfs as the backing file system. I wonder if we can boil > this down into a test case and try and figure out what is doing on here. Yes I'd say it's fs specific, I've not been able to reproduce on ext4 or xfs -- but then again I couldn't reproduce with btrfs on a new filesystem so there probably are some other conditions :/ I also agree writing a simple program like the io_uring test in the above commit that'd sort of do it like qemu and compare contents would be ideal. I'll have a stab at this today. -- Dominique