From: Omar Sandoval <osandov@osandov.com>
To: Markus Schauler <mschauler@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: BTRFS issue: deleting default snapshot causes kernel oops
Date: Sat, 30 May 2015 01:58:40 -0700 [thread overview]
Message-ID: <20150530085840.GA24210@mew> (raw)
In-Reply-To: <CAB8YbStYrFTnY6Jt03b=etgJ73pWO_xSN0SMingNtOOnMbjTvg@mail.gmail.com>
On Fri, May 29, 2015 at 11:14:13PM +0200, Markus Schauler wrote:
> Hi,
>
> I'm having an issue with Btrfs on an opensuse Tumbleweed system using
> kernel 4.0.4-1
>
> Here's what happened:
> I use the snapper tool to create periodic snapshots of the root FS
> After having problems with an update, I rolled back my system by
> seting the default subvolume for / to snapshot 398 (the last good
> snapshot)
> After rebooting, everything was fine.
>
> Some days later, snapper decided to delete the old snapshot 398 (that
> was mounted as /)
> Then, the system stopped with this error:
[snipped]
Oh, this is kind of amusing. I couldn't reproduce the oops, but I did
get some buggy behavior.
In my test setup, snap1 on /dev/vda1 is the default subvolume and
mounted as root.
# mount -osubvol=/ /dev/vda1 /mnt
# btrfs subvol del /mnt/snap1
Delete subvolume (no-commit): '/mnt/snap1'
ERROR: cannot delete '/mnt/snap1' - Operation not permitted
# ls /
bin boot dev etc home lib lib64 mnt mnt2 opt proc root run sbin srv sys tmp usr var
Okay, looks fine so far. Let's double check the mounted filesystems...
# findmnt
findmnt: can't read /proc/mounts: No such file or directory
Huh?
# ls /proc
# ls /dev
# ls /sys
#
Nothing. The problem is clear looking at btrfs_ioctl_snap_destroy():
d_invalidate(dentry);
down_write(&root->fs_info->subvol_sem);
err = may_destroy_subvol(dest);
if (err)
goto out_up_write;
And d_invalidate():
* d_invalidate - detach submounts, prune dcache, and drop
So /proc and friends all got unmounted BEFORE we backed out and realized
that this was a bad idea, which explains what I saw. My wild guess is
that the crash you saw was a side effect of the root dentry being
dropped :)
This happens because d_invalidate() doesn't fail for a mounted subvolume
anymore (the same thing that made it possible to delete mounted
subvolumes in general). The fix should be simple enough: don't
d_invalidate() until after we check may_destroy_subvol(). I'll send in a
patch.
--
Omar
prev parent reply other threads:[~2015-05-30 8:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 21:14 BTRFS issue: deleting default snapshot causes kernel oops Markus Schauler
2015-05-30 8:58 ` Omar Sandoval [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=20150530085840.GA24210@mew \
--to=osandov@osandov.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mschauler@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