All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Jakob Unterwurzacher <jakobunt@gmail.com>, linux-btrfs@vger.kernel.org
Subject: Re: fallocate does not prevent ENOSPC on write
Date: Tue, 23 Apr 2019 13:33:02 +0200	[thread overview]
Message-ID: <20190423113302.GS20156@twin.jikos.cz> (raw)
In-Reply-To: <f64c6b65-5f21-48eb-6e1e-db30cbe57545@gmx.com>

On Tue, Apr 23, 2019 at 10:16:32AM +0800, Qu Wenruo wrote:
> On 2019/4/23 上午5:09, Jakob Unterwurzacher wrote:
> > I have a user who is reporting ENOSPC errors when running gocryptfs on
> > top of btrfs (ticket: https://github.com/rfjakob/gocryptfs/issues/395 ).
> > 
> > What is interesting is that the error gets thrown at write time. This
> > is not supposed to happen, because gocryptfs does
> > 
> >     fallocate(..., FALLOC_FL_KEEP_SIZE, ...)
> > 
> > before writing.
> > 
> > I wrote a minimal reproducer in C: https://github.com/rfjakob/fallocate_write
> > This is what it looks like on ext4:
> > 
> >     $ ../fallocate_write/fallocate_write
> >     reading from /dev/urandom
> >     writing to ./blob.379Q8P
> >     writing blocks of 132096 bytes each
> >     [...]
> >     fallocate failed: No space left on device
> > 
> > On btrfs, it will instead look like this:
> > 
> >     [...]
> >     pwrite failed: No space left on device
> > 
> > Is this a bug in btrfs' fallocate implementation or am I reading the
> > guarantees that fallocate gives me wrong?
> 
> Since v4.7, this commit changed the how btrfs do NodataCOW check:
> c6887cd11149 ("Btrfs: don't do nocow check unless we have to").
> 
> Before that commit, btrfs always check if they need to reserve space for
> COW, while after that patch, btrfs never checks unless we have no space.
> 
> However this screws up other nodatacow space check.
> And due to its age and deep changeset, it's pretty hard to fix it.
> I have tried several times, but it will only cause more problems.

What if the commit is reverted, if the problem is otherwise hard to fix?
This seems to break the semantics of fallocate so the performance should
not the main concern here.

  reply	other threads:[~2019-04-23 11:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 21:09 fallocate does not prevent ENOSPC on write Jakob Unterwurzacher
2019-04-23  2:16 ` Qu Wenruo
2019-04-23 11:33   ` David Sterba [this message]
2019-04-23 12:12     ` Qu Wenruo
2019-04-23 14:50       ` Filipe Manana
2019-04-23 19:21         ` Jakob Unterwurzacher
2019-04-23 23:56           ` Zygo Blaxell
2019-04-27 11:25             ` Jakob Unterwurzacher
2019-04-23 23:49         ` Qu Wenruo
2019-04-24  9:28           ` Filipe Manana
2019-04-24  9:50             ` Qu Wenruo
2019-04-25  5:49     ` Qu Wenruo
2019-04-25 13:25       ` Josef Bacik
2019-04-25 13:50         ` Qu Wenruo
2019-04-25 14:09           ` Josef Bacik
2019-04-25 14:11             ` Qu Wenruo
2019-04-25 14:13               ` Josef Bacik
2019-04-25 14:16                 ` Qu Wenruo
2019-04-26 12:47                 ` David Sterba
2019-04-25 14:43               ` Filipe Manana
2019-04-25 23:16                 ` Qu Wenruo
2019-04-25 14:39       ` Filipe Manana

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=20190423113302.GS20156@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=jakobunt@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.