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
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.
Created attachment 679166 [details] allow mounting of btrfs volumes with inconsistent quota information
This is a bug in btrfs, but at least part of it is within the kernel.
I verified my patch as working, though I'm not sure that it's the best possible patch, it is a patch that works.
(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?
(In reply to comment #5) > Did you send this to the upstream developers? I sent the patch to the mailing list, yes.
http://www.spinics.net/lists/linux-btrfs/msg21464.html
Fixed upstream.