From patchwork Fri Mar 8 20:42:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2240341 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1A453DF215 for ; Fri, 8 Mar 2013 20:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753488Ab3CHUfX (ORCPT ); Fri, 8 Mar 2013 15:35:23 -0500 Received: from dkim2.fusionio.com ([66.114.96.54]:57957 "EHLO dkim2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753319Ab3CHUfW (ORCPT ); Fri, 8 Mar 2013 15:35:22 -0500 Received: from mx2.fusionio.com (unknown [10.101.1.160]) by dkim2.fusionio.com (Postfix) with ESMTP id 8E9189A0407 for ; Fri, 8 Mar 2013 13:35:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1362774920; bh=/TILgk6UfySo7YG0q9VTKGA81VbTgyH19bOtclCgxNw=; h=From:To:Subject:Date; b=AkMBqycaVZ8zNqWyI1CIhHY2XCdDcCRyLaedHSE3NzGbddeLE1u/S8EeQydyOGP1f +Qs31GXn1F4eRbDK2AoonK0YqvbqL1TVZ2SByyfaiiaBM9vWBAeWg8p9bUtawRwBIT V2iib8FKZkPKndOwmL9Xvy9Q6zzRp3oG4N/3MBvI= X-ASG-Debug-ID: 1362774920-0421b554940c8c0001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx2.fusionio.com with ESMTP id DgaUOC76UN0REZ5a (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 08 Mar 2013 13:35:20 -0700 (MST) X-Barracuda-Envelope-From: JBacik@fusionio.com Received: from localhost (98.26.82.158) by mail.fusionio.com (10.101.1.19) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 8 Mar 2013 13:35:19 -0700 From: Josef Bacik To: Subject: [PATCH] Btrfs: return EIO if we have extent tree corruption Date: Fri, 8 Mar 2013 15:42:31 -0500 X-ASG-Orig-Subj: [PATCH] Btrfs: return EIO if we have extent tree corruption Message-ID: <1362775351-2620-1-git-send-email-jbacik@fusionio.com> X-Mailer: git-send-email 1.7.7.6 MIME-Version: 1.0 X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] X-Barracuda-Start-Time: 1362774920 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.181:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.124637 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The callers of lookup_inline_extent_info all handle getting an error back properly, so return an error if we have corruption instead of being a jerk and panicing. Still WARN_ON() since this is kind of crucial and I've been seeing it a bit too much recently for my taste, I think we're doing something wrong somewhere. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/extent-tree.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index dd23e8e..742b7a7 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1538,8 +1538,11 @@ again: if (ret && !insert) { err = -ENOENT; goto out; + } else if (ret) { + err = -EIO; + WARN_ON(1); + goto out; } - BUG_ON(ret); /* Corruption */ leaf = path->nodes[0]; item_size = btrfs_item_size_nr(leaf, path->slots[0]);