From patchwork Mon Apr 24 11:27:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen K Pandey X-Patchwork-Id: 9696033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F32BF601E9 for ; Mon, 24 Apr 2017 11:27:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4A1C26223 for ; Mon, 24 Apr 2017 11:27:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8FA827FA6; Mon, 24 Apr 2017 11:27:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC46226223 for ; Mon, 24 Apr 2017 11:27:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1169249AbdDXL1s (ORCPT ); Mon, 24 Apr 2017 07:27:48 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39632 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1169234AbdDXL1g (ORCPT ); Mon, 24 Apr 2017 07:27:36 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3OBOE3U103658 for ; Mon, 24 Apr 2017 07:27:35 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a02g36h99-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 24 Apr 2017 07:27:35 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Apr 2017 07:27:34 -0400 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 24 Apr 2017 07:27:31 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v3OBRYZc43909196; Mon, 24 Apr 2017 11:27:34 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1510112047; Mon, 24 Apr 2017 07:27:29 -0400 (EDT) Received: from localhost.in.ibm.com (unknown [9.124.35.225]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP id D8197112051; Mon, 24 Apr 2017 07:27:28 -0400 (EDT) From: Praveen K Pandey To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, Praveen K Pandey Subject: [PATCH] Btrfs-progs: run_next_block: Return error code when extent buffer read fails Date: Mon, 24 Apr 2017 16:57:17 +0530 X-Mailer: git-send-email 2.5.5 X-TM-AS-GCONF: 00 x-cbid: 17042411-0008-0000-0000-000002019F57 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006964; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000208; SDB=6.00851740; UDB=6.00420939; IPR=6.00630576; BA=6.00005310; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015156; XFM=3.00000013; UTC=2017-04-24 11:27:32 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042411-0009-0000-0000-000034E2F8DE Message-Id: <1493033237-12979-1-git-send-email-praveen@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-24_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704240203 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- cmds-check.c | 1 + 1 file changed, 1 insertion(+) 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; }