On Tue, Mar 16, 2021 at 04:53:46PM +0000, [email protected] wrote:
> From: Filipe Manana <[email protected]>
> 
> During the mount procedure we are calling btrfs_orphan_cleanup() against
> the root tree, which will find all orphans items in this tree. When an
> orphan item corresponds to a deleted subvolume/snapshot (instead of an
> inode space cache), it must not delete the orphan item, because that will
> cause btrfs_find_orphan_roots() to not find the orphan item and therefore
> not add the corresponding subvolume root to the list of dead roots, which
> results in the subvolume's tree never being deleted by the cleanup thread.
> 
> The same applies to the remount from RO to RW path.
> 
> Fix this by making btrfs_find_orphan_roots() run before calling
> btrfs_orphan_cleanup() against the root tree.
> 
> A test case for fstests will follow soon.
> 
> Reported-by: Robbie Ko <[email protected]>
> Link: 
> https://lore.kernel.org/linux-btrfs/[email protected]/
> Fixes: 638331fa56caea ("btrfs: fix transaction leak and crash after cleaning 
> up orphans on RO mount")
> Signed-off-by: Filipe Manana <[email protected]>

Added to misc-next, thanks.

Reply via email to