Skip to contentSkip to conversation

Btrfs-progs: run_next_block: Return error code when extent buffer read fails

PATCH Applied Praveen K Pandey 2 participants 2 messages Apr 24, 2017 – May 2, 2017 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs-progs: run_next_block: Return error code when extent buffer read fails

run_next_block() ignores the return value of read_tree_block() and always returns success status. This might cause deal_root_from_list() to loop infinitely when reading metadata block fails. This bug fixes the issue by extracting and returning the error code from the return value of read_tree_block().

Bug ID : https://bugzilla.kernel.org/show_bug.cgi?id=155551

---
 cmds-check.c | 1 +
 1 file changed, 1 insertion(+)
cmds-check.c +1 -0
index 17b7efb..40e3c99 100644
@@ -7625,6 +7625,7 @@ static int run_next_block(struct btrfs_root *root,
 	if (!extent_buffer_uptodate(buf)) {
 		record_bad_block_io(root->fs_info,
 				    extent_cache, bytenr, size);
+		ret = PTR_ERR(buf);
 		goto out;
 	}
 
Signature · 1 line
2.5.5
Applied
#1 lore raw
Quoted 9 lines · Praveen K Pandey

run_next_block() ignores the return value of read_tree_block() and always returns success status. This might cause deal_root_from_list() to loop infinitely when reading metadata block fails. This bug fixes the issue by extracting and returning the error code from the return value of read_tree_block().

Bug ID : https://bugzilla.kernel.org/show_bug.cgi?id=155551

Applied, thanks. As noted in the bug, there are many more to fix.