diff mbox

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

Message ID 1493033237-12979-1-git-send-email-praveen@linux.vnet.ibm.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Praveen K Pandey April 24, 2017, 11:27 a.m. UTC
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

Signed-off-by: Praveen K Pandey <praveen@linux.vnet.ibm.com>
---
 cmds-check.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba May 2, 2017, 5:14 p.m. UTC | #1
On Mon, Apr 24, 2017 at 04:57:17PM +0530, Praveen K Pandey wrote:
> 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
> 
> Signed-off-by: Praveen K Pandey <praveen@linux.vnet.ibm.com>

Applied, thanks. As noted in the bug, there are many more to fix.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-check.c b/cmds-check.c
index 17b7efb..40e3c99 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -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;
 	}