Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: btrfs blocks root from writing even when there is plenty of statfs->f_bfree
Date: Thu, 24 Aug 2023 16:33:04 -0400	[thread overview]
Message-ID: <dca245d8861cfa6ba65a4ca4b74ff8adaba9bfc0.camel@kernel.org> (raw)

I've been doing some testing with btrfs exported via nfsd and hit this
bug. root is unable to write to the filesystem, even though statfs
reports that there should be 400k+ blocks available.

The reproducer is pretty simple. First I fill up the filesystem as an
unprivileged user (let this run until I hit ENOSPC):

[vagrant@kdevops-nfs-default btrfs]$ dd if=/dev/urandom of=/media/btrfs/bigfile bs=1M

...and then try to write to a file on the fs as root:

[root@kdevops-nfs-default btrfs]# strace -f -e statfs df .
statfs(".", {f_type=BTRFS_SUPER_MAGIC, f_bsize=4096, f_blocks=26214400, f_bfree=452204, f_bavail=0, f_files=0, f_ffree=0, f_fsid={val=[0xa9d43863, 0xb08b34cc]}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/nvme2n1   104857600 103048784         0 100% /media/btrfs
+++ exited with 0 +++
[root@kdevops-nfs-default btrfs]# xfs_io -f -c "pwrite -b 4096 4096 4096" ./file1
pwrite: No space left on device

This works on ext4 and xfs. The kernel is Linus' master branch as of a
couple of days ago:

    6.5.0-rc7-g081b0d4bef5d

Let me know if you need more info.
-- 
Jeff Layton <jlayton@kernel.org>

             reply	other threads:[~2023-08-24 20:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 20:33 Jeff Layton [this message]
2023-08-25  1:23 ` btrfs blocks root from writing even when there is plenty of statfs->f_bfree Qu Wenruo
2023-08-25  2:12   ` Qu Wenruo
2023-08-25 10:06     ` Jeff Layton

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=dca245d8861cfa6ba65a4ca4b74ff8adaba9bfc0.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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