@@ -2677,6 +2677,18 @@ again:
if (cur->start == cur_bytenr)
goto again;
+ /*
+ * path may point at the last item(a inode item maybe) in a leaf.
+ * Without below lines, walk_up_tree() will skip the item which
+ * means all items related to the inode will never be checked.
+ * Decrease the slot manually, walk_up_tree won't skip to next node
+ * if it occurs.
+ */
+ if (path->slots[0] + 1 >= btrfs_header_nritems(path->nodes[0])) {
+ if (path->slots[0])
+ path->slots[0]--;
+ }
+
/*
* we have switched to another leaf, above nodes may
* have changed, here walk down the path, if a node