]> git.hungrycats.org Git - linux/commit
btrfs: clear 'ret' in btrfs_check_shared() loop
authorMark Fasheh <mfasheh@suse.de>
Tue, 19 May 2015 19:49:50 +0000 (12:49 -0700)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Wed, 20 May 2015 02:27:26 +0000 (22:27 -0400)
commitc7e1b9ce19a3cf4c3d2c4abb95bcfae60f58837b
treefafe9f383207c81b2d6f82fbe422ae6647423621
parente3c12253a3c540a7fb831d5379617ac7fe1fa8a1
btrfs: clear 'ret' in btrfs_check_shared() loop

btrfs_check_shared() is leaking a return value of '1' from
find_parent_nodes(). As a result, callers (in this case, extent_fiemap())
are told extents are shared when they are not. This in turn broke fiemap on
btrfs for kernels v3.18 and up.

The fix is simple - we just have to clear 'ret' after we are done processing
the results of find_parent_nodes().

It wasn't clear to me at first what was happening with return values in
btrfs_check_shared() and find_parent_nodes() - thanks to Josef for the help
on irc. I added documentation to both functions to make things more clear
for the next hacker who might come across them.

If we could queue this up for -stable too that would be great.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
fs/btrfs/backref.c