Bug 895727 - btrfs quotas are easy to get into an inconsistent state
Summary: btrfs quotas are easy to get into an inconsistent state
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Josef Bacik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-15 21:19 UTC by Eric Hopper
Modified: 2013-09-23 20:28 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-09-23 20:28:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
allow mounting of btrfs volumes with inconsistent quota information (793 bytes, patch)
2013-01-15 23:29 UTC, Eric Hopper
no flags Details | Diff

Description Eric Hopper 2013-01-15 21:19:25 UTC
Description of problem:
Using a few commands related to btrfs quotas it's trivial to get btrfs into an inconsistent state

Version-Release number of selected component (if applicable):
Not sure exactly. The kernel shipped with Fedora 18 has the problem, but I'm not sure about kernels after that. I think they all do.

How reproducible:
Every time

Steps to Reproduce:
mkfs.btrfs /dev/sdb
mkdir /tmp/mnt
mount /dev/sdb /tmp/mnt
cd /tmp/mnt
btrfs quota enable .
btrfs subvol create foo
btrfs qgroup create 1/0
btrfs qgroup assign 0/257 1/0
btrfs subvol snapshot foo bar
btrfs qgroup assign 0/258 1/0
cd ..
umount /dev/sdb
mount /dev/sdb /tmp/mnt
# Still mountable!
cd mnt
btrfs qgroup destroy 1/0
cd ..
umount /dev/sdb
mount /dev/sdb /tmp/mnt
# Oops, no longer mountable, even in recovery mode!
  
Actual results:
Unmountable filesystem

Expected results:
A filesystem that I can still mount

Additional info:
http://www.spinics.net/lists/linux-btrfs/index.html#21463

Comment 1 Eric Hopper 2013-01-15 23:28:00 UTC
This will likely need two fixes.

First, according to sensille (aka Arne Jansen, owner of this development tree http://git.kernel.org/?p=linux/kernel/git/arne/linux-btrfs.git;a=summary) on Freenode, inconsistencies in the quota subsystem are not supposed to prevent mounting.

Secondly, btrfs qgroup destroy leaves BTRFS_QGROUP_RELATION_KEY nodes lying around that refer to the destroyed qgroup. This should probably also be fixed.

I have a patch which I think should fix the first problem, and I will attach it to this bug.

Comment 2 Eric Hopper 2013-01-15 23:29:48 UTC
Created attachment 679166 [details]
allow mounting of btrfs volumes with inconsistent quota information

Comment 3 Eric Hopper 2013-01-15 23:30:39 UTC
This is a bug in btrfs, but at least part of it is within the kernel.

Comment 4 Eric Hopper 2013-01-16 06:05:19 UTC
I verified my patch as working, though I'm not sure that it's the best possible patch, it is a patch that works.

Comment 5 Josh Boyer 2013-01-16 14:34:17 UTC
(In reply to comment #4)
> I verified my patch as working, though I'm not sure that it's the best
> possible patch, it is a patch that works.

Did you send this to the upstream developers?

Comment 6 Eric Hopper 2013-01-16 15:22:50 UTC
(In reply to comment #5)
> Did you send this to the upstream developers?

I sent the patch to the mailing list, yes.

Comment 8 Josef Bacik 2013-09-23 20:28:40 UTC
Fixed upstream.


Note You need to log in before you can comment on or make changes to this bug.