From: Christoph Hellwig <hch@infradead.org>
To: Leo Martins <loemra.dev@gmail.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org
Subject: Re: [PATCH] generic/747: handle ENOSPC gracefully during write/delete cycles
Date: Tue, 24 Mar 2026 22:50:15 -0700 [thread overview]
Message-ID: <acN3l8gGjA8gaZeE@infradead.org> (raw)
In-Reply-To: <20260324234010.590043-1-loemra.dev@gmail.com>
On Tue, Mar 24, 2026 at 04:39:43PM -0700, Leo Martins wrote:
> > The test fills a filesystem to 95% then does mixed write/delete cycles,
> > using statfs to decide whether to write or delete. However, statfs
> > f_bavail may overestimate the actual available space. On btrfs, the
> > statfs implementation documents its estimate as "a close approximation"
> > (fs/btrfs/super.c). At high fill levels the discrepancy between what
> > statfs reports and what the filesystem can actually allocate becomes
> > significant, causing dd to hit ENOSPC even though statfs indicated
> > there was room.
> > This is not a filesystem bug. The filesystem correctly rejects the
> > write when it cannot reserve space. The test's purpose is to stress
> > garbage collection through write/delete churn, not to validate space
> > accounting.
f_bavail overestimating is a btrfs implementation bug that needs fixing.
It can be wrong, but it needs to be too low in doubt. Without this
you're going to cause unexpected ENOSPC for real life applictions as
well (and btrfs does have a bit of a reputation for that, so fixing
this properly will benefit your users!)
next prev parent reply other threads:[~2026-03-25 5:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 23:33 [PATCH] generic/747: handle ENOSPC gracefully during write/delete cycles Leo Martins
2026-03-24 23:39 ` Leo Martins
2026-03-25 5:50 ` Christoph Hellwig [this message]
2026-03-25 6:23 ` Qu Wenruo
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=acN3l8gGjA8gaZeE@infradead.org \
--to=hch@infradead.org \
--cc=fstests@vger.kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=loemra.dev@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