Re: [PATCH v2] btrfs: fix possible free space tree corruption with online conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 10, 2020 at 09:32:31AM -0500, Josef Bacik wrote:
> While running btrfs/011 in a loop I would often ASSERT() while trying to
> add a new free space entry that already existed, or get an -EEXIST while
> adding a new block to the extent tree, which is another indication of
> double allocation.

Do you have the stack traces? I'll update the changelog if you send it.

> This occurs because when we do the free space tree population, we create
> the new root and then populate the tree and commit the transaction.
> The problem is when you create a new root, the root node and commit root
> node are the same.  This means that caching a block group before the
> transaction is committed can race with other operations modifying the
> free space tree, and thus you can get double adds and other sort of
> shenanigans.  This is only a problem for the first transaction, once
> we've committed the transaction we created the free space tree in we're
> OK to use the free space tree to cache block groups.
> 
> Fix this by marking the fs_info as unsafe to load the free space tree,
> and fall back on the old slow method.  We could be smarter than this,
> for example caching the block group while we're populating the free
> space tree, but since this is a serious problem I've opted for the
> simplest solution.

Makes sense, this is a one-time thing during setup.

> cc: stable@xxxxxxxxxxxxxxx

CC: stable@xxxxxxxxxxxxxxx

If you send patch with the tag it's good to also note the minimal
version where it's relevant as you can easily reuse the knowledge from
developing the fix. The patch may not apply due to other changes, but
trivial context fixups are done by people interested in the backports.

> Fixes: a5ed91828518 ("Btrfs: implement the free space B-tree")

So if you know the offending commit, run

  $ git describe --contains a5ed91828518
  v4.5-rc1~21^2~22^2^2~3

which is 4.9.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux