linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [RFC][PATCH 0/5] btrfs: fix hole corruption issue with !NO_HOLES
Date: Thu, 2 Jan 2020 11:10:21 -0500	[thread overview]
Message-ID: <12fa044c-fc1f-41e7-75e1-81523b4ada4d@toxicpanda.com> (raw)
In-Reply-To: <d47f690d-6c3a-c69b-bcf7-dd1062c2692d@gmx.com>

On 12/31/19 7:25 AM, Qu Wenruo wrote:
> 
> 
> On 2019/12/31 上午5:31, Josef Bacik wrote:
>> We've historically had this problem where you could flush a targeted section of
>> an inode and end up with a hole between extents without a hole extent item.
>> This of course makes fsck complain because this is not ok for a file system that
>> doesn't have NO_HOLES set.  Because this is a well understood problem I and
>> others have been ignoring fsck failures during certain xfstests (generic/475 for
>> example) because they would regularly trigger this edge case.
>>
>> However this isn't a great behavior to have, we should really be taking all fsck
>> failures seriously, and we could potentially ignore fsck legitimate fsck errors
>> because we expect it to be this particular failure.
>>
>> In order to fix this we need to keep track of where we have valid extent items,
>> and only update i_size to encompass that area.  This unfortunately means we need
>> a new per-inode extent_io_tree to keep track of the valid ranges.  This is
>> relatively straightforward in practice, and helpers have been added to manage
>> this so that in the case of a NO_HOLES file system we just simply skip this work
>> altogether.
> 
> Not an expert of this problem, but AFAIK this is caused by mixing
> buffered and direct IO, right?
> 
> Since that deadly mix is not recommended anyway, can we make things
> simpler by just block any buffered IO if the same inode is under going
> any direct IO?
>

This can happen if you write 100mb and then sync_file_range 1mb in the middle of 
the file, it's not just restricted to O_DIRECT.  Thanks,

Josef

      reply	other threads:[~2020-01-02 16:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30 21:31 [RFC][PATCH 0/5] btrfs: fix hole corruption issue with !NO_HOLES Josef Bacik
2019-12-30 21:31 ` [PATCH 1/5] btrfs: use btrfs_ordered_update_i_size in clone_finish_inode_update Josef Bacik
2019-12-30 21:31 ` [PATCH 2/5] btrfs: introduce the inode->file_extent_tree Josef Bacik
2020-01-06 17:22   ` David Sterba
2020-01-06 19:29     ` Josef Bacik
2020-01-07 16:17       ` David Sterba
2020-01-07 16:45         ` Filipe Manana
2020-01-07 16:46   ` David Sterba
2019-12-30 21:31 ` [PATCH 3/5] btrfs: use the file extent tree infrastructure Josef Bacik
2019-12-30 21:31 ` [PATCH 4/5] btrfs: replace all uses of btrfs_ordered_update_i_size Josef Bacik
2019-12-30 21:31 ` [PATCH 5/5] btrfs: delete the ordered isize update code Josef Bacik
2019-12-31 12:25 ` [RFC][PATCH 0/5] btrfs: fix hole corruption issue with !NO_HOLES Qu Wenruo
2020-01-02 16:10   ` Josef Bacik [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=12fa044c-fc1f-41e7-75e1-81523b4ada4d@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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).