btrfs-progs: Fix an infinite loop in btrfs_next_bg
authorJustin Maggard <jmaggard10@gmail.com>
Fri, 9 Jun 2017 18:09:35 +0000 (11:09 -0700)
committerDavid Sterba <dsterba@suse.com>
Thu, 20 Jul 2017 15:43:43 +0000 (17:43 +0200)
commite2fd79c243f9939851d69d369a588953a6d070f7
tree1375309db2d9f875eae2f22d7849a4665ac33582
parentd0379cc1d0a34313e7436cdc75e418515f9b03fc
btrfs-progs: Fix an infinite loop in btrfs_next_bg

I've run into a couple filesystems where btrfs-find-root would spin
indefinitely.

If the first cache extent start location is 0, we end up in an infinite
loop in btrfs_next_bg().  Fix it by checking for that situation, and
jumping to the next bg if necessary.

Fixes: e2e0dae9 (btrfs-progs: volume: Fix a bug causing btrfs-find-root to skip first chunk)
Signed-off-by: Justin Maggard <jmaggard@netgear.com>
Signed-off-by: David Sterba <dsterba@suse.com>
volumes.c