scoutfs_btree_prev() searches prev block, not next

Oops, scoutfs_btree_prev() asked btree_walk() for the key for the next
block, not the previous block to search when it's walk lands in the
space before all the items in the leaf block.

I saw it when truncate's check_size_eq constraint failed on items
outside the range which stopped the truncate and left inodes, extents,
and the orphan item around after rm -rf.

Signed-off-by: Zach Brown <zab@versity.com>
Reviewed-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
Zach Brown
2016-11-16 11:30:31 -08:00
parent af5955e95a
commit f1b29c8372

View File

@@ -1406,7 +1406,7 @@ int scoutfs_btree_prev(struct super_block *sb, struct scoutfs_btree_root *root,
ret = -ENOENT;
while (scoutfs_key_cmp(&key, first) >= 0) {
bl = btree_walk(sb, root, &key, NULL, &prev_key, 0, 0, 0);
bl = btree_walk(sb, root, &key, &prev_key, NULL, 0, 0, 0);
if (IS_ERR(bl)) {
ret = PTR_ERR(bl);
break;