linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: dsterba@suse.cz, "Austin S. Hemmelgarn" <ahferroin7@gmail.com>,
	"Holger Hoffstätte" <holger@applied-asynchrony.com>,
	linux-btrfs@vger.kernel.org, quwenruo@cn.fujitsu.com,
	osandov@fb.com
Subject: Re: Status of free-space-tree feature
Date: Thu, 22 Sep 2016 10:02:00 -0700	[thread overview]
Message-ID: <20160922170200.GA4705@vader.DHCP.thefacebook.com> (raw)
In-Reply-To: <20160922085205.GM16983@suse.cz>

On Thu, Sep 22, 2016 at 10:52:05AM +0200, David Sterba wrote:
> On Wed, Sep 21, 2016 at 01:31:52PM -0700, Omar Sandoval wrote:
> > > > I'm not sure I understand - can you explain why this is was so wrong?
> > > > Or Omar maybe?
> > > > 
> > > > If btrfsck wants to correct something (write), it can simply always
> > > > and unconditionally invalidate the fst instead of trying to "repair"
> > > > it..and I think that's what happens at the moment (at least I think
> > > > it did for me recently). That seems like a safe and simple way.
> > > I know this is what it does with the regular FSC, but I'm not sure if it
> > > does so with the FST.  If it doesn't, it probably should though.
> > 
> > It doesn't. The free space cache is easy to invalidate because we can
> > just compare the generation number of the superblock to that of the
> > space cache, but as it exists now, the free space tree doesn't have
> > anything equivalent. That means that any modifications that btrfs-progs
> > made to a space_cache=v2 filesystem could potentially have caused
> > filesystem corruption :/
> > 
> > However, I talked this through with Chris, and he came up with a great
> > idea that will help us deal with both this issue and the endianness
> > issue [1] in one fell swoop. Basically, my objection to adding a compat
> > bit for the endianness bug was that it would unnecessarily affect the
> > vast majority of users on x86; forcing those users to recreate their
> > free space tree seemed silly. However, because of the btrfs-progs bug,
> > just to be safe, we might as well force everyone to recreate their free
> > space tree.
> > 
> > The solution is to add a FREE_SPACE_TREE_VALID compat_ro bit. If the bit
> > isn't set, then we destroy and rebuild the free space tree. This covers
> > the case of big-endian kernels which created broken free space trees and
> > filesystems which could have possibly gone through btrfs-progs.
> > 
> > This time we'll make sure not to make btrfs-progs think it can mount
> > FREE_SPACE_TREE_VALID filesystems read-write. We can even have
> > btrfs-progs check for that bit and clear it if it's mounting read-write.
> > The next time it gets mounted, the kernel will recreate the tree. It's
> > not pretty, but it'll work.
> 
> Sounds like a good plan to me. The bit is a form of 'clear_cache' mount.
> We need to to a coordinated fix (kernel, progs), if the patches are
> ready soon, 4.9 is feasible target.

I'll try to get them out later today.

-- 
Omar

      parent reply	other threads:[~2016-09-22 17:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  9:24 Status of free-space-tree feature David Sterba
2016-09-21 10:25 ` Holger Hoffstätte
2016-09-21 12:12   ` Austin S. Hemmelgarn
2016-09-21 20:31     ` Omar Sandoval
2016-09-22  8:52       ` David Sterba
2016-09-22 10:10         ` Hans van Kranenburg
2016-09-22 17:26           ` Omar Sandoval
2016-09-22 17:47             ` ojab
2016-09-22 17:50               ` Omar Sandoval
2016-09-22 17:02         ` 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=20160922170200.GA4705@vader.DHCP.thefacebook.com \
    --to=osandov@osandov.com \
    --cc=ahferroin7@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=holger@applied-asynchrony.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=osandov@fb.com \
    --cc=quwenruo@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).