btrfs: skip log replay on orphaned roots
commitf597f873ae0ed4c58a043c6d9bcfd7f5a04beca5
authorJosef Bacik <josef@toxicpanda.com>
Fri, 6 Dec 2019 14:37:17 +0000 (6 09:37 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:42:03 +0000 (31 16:42 +0100)
tree8b4954b9ac949483c0e0c27d0289245b79321ffe
parentc1db18e292d30191d141246445cd471a7b25af65
btrfs: skip log replay on orphaned roots

commit 9bc574de590510eff899c3ca8dbaf013566b5efe upstream.

My fsstress modifications coupled with generic/475 uncovered a failure
to mount and replay the log if we hit a orphaned root.  We do not want
to replay the log for an orphan root, but it's completely legitimate to
have an orphaned root with a log attached.  Fix this by simply skipping
replaying the log.  We still need to pin it's root node so that we do
not overwrite it while replaying other logs, as we re-read the log root
at every stage of the replay.

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/tree-log.c