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. > > <snip> > > > > > 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