From patchwork Wed Apr 24 20:51:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2486311 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 9F941DFE75 for ; Wed, 24 Apr 2013 20:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758253Ab3DXUvS (ORCPT ); Wed, 24 Apr 2013 16:51:18 -0400 Received: from dkim2.fusionio.com ([66.114.96.54]:37795 "EHLO dkim2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758209Ab3DXUvQ (ORCPT ); Wed, 24 Apr 2013 16:51:16 -0400 Received: from mx2.fusionio.com (unknown [10.101.1.160]) by dkim2.fusionio.com (Postfix) with ESMTP id C03A09A068E for ; Wed, 24 Apr 2013 14:51:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1366836675; bh=jyxT66TcHtadf0SeDi97TzzCxOgo4l4+99vo4CgG3jY=; h=From:To:Subject:Date; b=rnYm9sU7u+5LN8bud7XTA9ozqh3nz2Y90z4RikDtavbE1m7lTURhP7RgcqYshAZOT yzimQOQT/Fj+MveEcc07+kBDp6Vvci+VNSmDgS7NMcaGgNUmvLctT3KmeF9oadbh6h dCq9L6thi8nC80r4Rt9OHZIsHZ7uMvhVMDZqvpUA= X-ASG-Debug-ID: 1366836675-0421b5172b121930001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx2.fusionio.com with ESMTP id 1UqCrOV5qJXwmbZa (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Wed, 24 Apr 2013 14:51:15 -0600 (MDT) X-Barracuda-Envelope-From: JBacik@fusionio.com Received: from localhost (76.182.72.146) by mail.fusionio.com (10.101.1.19) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 24 Apr 2013 14:51:14 -0600 From: Josef Bacik To: Subject: [PATCH] Btrfs: don't panic if we're trying to drop too many refs Date: Wed, 24 Apr 2013 16:51:13 -0400 X-ASG-Orig-Subj: [PATCH] Btrfs: don't panic if we're trying to drop too many refs Message-ID: <1366836673-2100-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: 1366836675 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.129061 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 This is just obnoxious. Just print a message, abort the transaction, and return an error. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/extent-tree.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 52b7e15..796c4ef 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5613,7 +5613,13 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, } refs = btrfs_extent_refs(leaf, ei); - BUG_ON(refs < refs_to_drop); + if (refs < refs_to_drop) { + btrfs_err(info, "trying to drop %d refs but we only have %Lu " + "for bytenr %Lu\n", refs_to_drop, refs, bytenr); + ret = -EINVAL; + btrfs_abort_transaction(trans, extent_root, ret); + goto out; + } refs -= refs_to_drop; if (refs > 0) {