btrfs: check the root node for uptodate before returning it
authorJosef Bacik <josef@toxicpanda.com>
Wed, 24 Nov 2021 19:14:24 +0000 (14:14 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:15 +0000 (11:05 +0100)
commit724d9fa55cbea7ed9e61500da0f13a1dd660bd6c
tree5127d76ff1a957d865bf032bf873423db165afbf
parentef383621b12512b241dc0d01ecdb2285d2437fbc
btrfs: check the root node for uptodate before returning it

commit 120de408e4b97504a2d9b5ca534b383de2c73d49 upstream.

Now that we clear the extent buffer uptodate if we fail to write it out
we need to check to see if our root node is uptodate before we search
down it.  Otherwise we could return stale data (or potentially corrupt
data that was caught by the write verification step) and think that the
path is OK to search down.

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Nikolay Borisov <nborisov@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/ctree.c