From f1b29c8372def30a7528f339e1eda95dd23e39c8 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 16 Nov 2016 11:30:31 -0800 Subject: [PATCH] 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 Reviewed-by: Mark Fasheh --- kmod/src/btree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/src/btree.c b/kmod/src/btree.c index 9342b209..a1410134 100644 --- a/kmod/src/btree.c +++ b/kmod/src/btree.c @@ -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;