linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@kernel.org>
To: "Марк Коренберг" <socketpair@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Major bug in BTRFS (syncs are ignored with libaio or io_uring)
Date: Fri, 11 Nov 2022 12:01:21 +0000	[thread overview]
Message-ID: <CAL3q7H4HyaTy802=YffnboKTEN2KdGmLX3z=g=HfABy2rtZLYQ@mail.gmail.com> (raw)
In-Reply-To: <CAL3q7H7RmDV2Xe2+Fb11Jr=NqPWQtw9V=En6JR1swS6Ocr5Z-w@mail.gmail.com>

On Fri, Oct 28, 2022 at 11:23 AM Filipe Manana <fdmanana@kernel.org> wrote:
>
> On Thu, Oct 27, 2022 at 11:08 PM Марк Коренберг <socketpair@gmail.com> wrote:
> >
> > How to reproduce (I tested in kernel 6.1):
> >
> > 2.  mkfs.btrfs over a partition.
> > 3.  mount -o lazytime,noatime
> > 4.  touch file.dat
> > 5.  chattr +C file.dat # turns off compression, checksumming and COW
> > 6.  fallocate -l1G file.dat
> > 7.  # prefill the file with random data
> >     fio -ioengine=psync                      -name=test -bs=1M
> > -rw=write                 -filename=file.dat
> > 8.  fio -ioengine=psync    -sync=1 -direct=1 -name=test -bs=4k
> > -rw=randwrite -runtime=60 -filename=file.dat  # Will show, say, 2K
> > IOPs
> > 9.  fio -ioengine=io_uring -sync=1 -direct=1 -name=test -bs=4k
> > -rw=randwrite -runtime=60 -filename=file.dat  # Will show, say, 32K
> > IOPs
> > 10. fio -ioengine=libaio   -sync=1 -direct=1 -name=test -bs=4k
> > -rw=randwrite -runtime=60 -filename=file.dat  # Will show, say, 32K
> > IOPs
> >
> > Steps 9 and 10 show implausible IOPs.
> >
> > This does not happen on, say, Ext4 (all the methods give roughly the same IOPs).
> >
> > Removing -sync=1 on all engines on Ext4 gives immediate return (as
> > expected because everything gets merged and finally written very fast)
> >
> > Adding/Removing -sync=1 with io_uring or libaio changes nothing on
> > BTRFS (it's definitely a bug)
>
> I confirm that the syncing is not happening often when using aio
> (either old aio or io_uring).
> I understand why it's happening, so I'll work on a fix for that.

Btw, I forgot to follow up, but the fix is already in Linus' tree:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8184620ae21213d51eaf2e0bd4186baacb928172

It was also backported to the 6.0.8 and 5.15.78 stable releases.

Thanks.

>
> Thanks for the report.
>
> >
> >
> > I consider it's a bug in BTRFS. Very important bug because BTRFS
> > becomes default FS in Fedora server/desktop now. This bug may cause
> > data loss. That's why I set this bug as high priority.
> >
> >
> > *****************
> > https://bugzilla.redhat.com/show_bug.cgi?id=2117971
> > *****************
> >
> >
> > --
> > Segmentation fault

      reply	other threads:[~2022-11-11 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 21:21 Major bug in BTRFS (syncs are ignored with libaio or io_uring) Марк Коренберг
2022-10-28  4:30 ` Andrei Borzenkov
2022-10-28  4:48   ` Марк Коренберг
2022-10-28 10:23 ` Filipe Manana
2022-11-11 12:01   ` Filipe Manana [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL3q7H4HyaTy802=YffnboKTEN2KdGmLX3z=g=HfABy2rtZLYQ@mail.gmail.com' \
    --to=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=socketpair@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).