By enabling the lowmem checks properly I uncovered the case where test
007 will infinite loop at the detection stage. This is because when
checking the inode item we will just btrfs_next_item(), and because we
ignore check tree block failures at read time we don't get an -EIO from
btrfs_next_leaf. Generally what check usually does is validate the
leaves/nodes as we hit them, but in this case we're not doing that. Fix
this by checking the leaf if we move to the next one and if it fails
bail. This allows us to pass the 007 test with lowmem.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
check/mode-lowmem.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 323e66bc..7fc7d467 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -2675,6 +2675,15 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
while (1) {
btrfs_item_key_to_cpu(path->nodes[0], &last_key, path->slots[0]);
ret = btrfs_next_item(root, path);
+
+ /*
+ * New leaf, we need to check it and see if it's valid, if not
+ * we need to bail otherwise we could end up stuck.
+ */
+ if (path->slots[0] == 0 &&
+ btrfs_check_leaf(gfs_info, NULL, path->nodes[0]))
+ ret = -EIO;
+
if (ret < 0) {
/* out will fill 'err' rusing current statistics */
goto out;--
2.26.3