From: Chris Webb <chris@arachsys.com>
To: linux-bcachefs@vger.kernel.org
Cc: Kent Overstreet <kent.overstreet@gmail.com>
Subject: rmdir() succeeds on an empty subvolume
Date: Sun, 10 Oct 2021 14:44:13 +0100 [thread overview]
Message-ID: <20211010134413.GA31142@arachsys.com> (raw)
If I create an empty snapshot in a bcachefs filesystem, I can then remove
the snapshot directory causing the filesystem to drop into an emergency
read-only state:
# bcachefs format -q /dev/zram1
initializing new filesystem
going read-write
mounted with opts: (null)
# mkdir -p /tmp/p
# mount -t bcachefs /dev/zram1 /tmp/p
# bcachefs subvolume create /tmp/p/s
# rmdir /tmp/p/s
# touch /tmp/p/test
touch: cannot touch '/tmp/p/test': Read-only file system
# dmesg -t | tail -n 6
bcachefs (zram1): recovering from clean shutdown, journal seq 4
bcachefs (zram1): going read-write
bcachefs (zram1): mounted with opts: (null)
bcachefs (zram1): missing subvolume 2
bcachefs (zram1): emergency read only
bcachefs (zram1): error deleting snapshot keys: -30
Since an unprivileged user can use bcachefs subvolume create in a directory
they own, they too can panic the filesystem by doing this.
Similarly, running rm -r on a directory containing a snapshot, the contents
of the snapshot are successfully cleared out before we run into trouble by
removing the subvolume inode.
I guess it should either succeed and delete the snapshot/subvolume, or it
should fail with EBUSY like rmdir() does on a mountpoint?
Best wishes,
Chris.
next reply other threads:[~2021-10-10 13:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-10 13:44 Chris Webb [this message]
2021-10-10 18:55 ` Other (perhaps related) subvolume strangeness Chris Webb
2021-10-11 15:44 ` Kent Overstreet
2021-10-11 19:10 ` Chris Webb
2021-10-11 21:07 ` [PATCH] [ktest] Test iterated snapshot create and delete with distinct names Chris Webb
2021-10-11 19:20 ` rmdir() succeeds on an empty subvolume Chris Webb
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=20211010134413.GA31142@arachsys.com \
--to=chris@arachsys.com \
--cc=kent.overstreet@gmail.com \
--cc=linux-bcachefs@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