From: Yan Zheng Date: Wed, 22 Jul 2009 13:59:00 +0000 (-0400) Subject: Btrfs: fix double increment of path->slots[0] in btrfs_next_leaf X-Git-Tag: v2.6.31-rc5~7^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e457afec60fdbd86b963d36f4a8a9285088c6043;p=platform%2Fkernel%2Flinux-stable.git Btrfs: fix double increment of path->slots[0] in btrfs_next_leaf if 1 is returned by btrfs_search_slot, the path already points to the first item with 'key > searching key'. So increasing path->slots[0] by one is superfluous in that case. Signed-off-by: Yan Zheng Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 60a45f3..7bb66c6 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -4146,7 +4146,8 @@ again: * advance the path if there are now more items available. */ if (nritems > 0 && path->slots[0] < nritems - 1) { - path->slots[0]++; + if (ret == 0) + path->slots[0]++; ret = 0; goto done; }