From patchwork Fri Sep 27 19:00:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2956651 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C1F7F9F3C4 for ; Fri, 27 Sep 2013 19:00:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B77FF202B8 for ; Fri, 27 Sep 2013 19:00:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A6C5202A1 for ; Fri, 27 Sep 2013 19:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754499Ab3I0TAv (ORCPT ); Fri, 27 Sep 2013 15:00:51 -0400 Received: from dkim1.fusionio.com ([66.114.96.53]:56425 "EHLO dkim1.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754332Ab3I0TAt (ORCPT ); Fri, 27 Sep 2013 15:00:49 -0400 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim1.fusionio.com (Postfix) with ESMTP id 2285F7C042D for ; Fri, 27 Sep 2013 13:00:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1380308449; bh=Z1rTpcd0Hv840fUddZZVaw6WzP+O0enBjAvE0F1eJGE=; h=From:To:Subject:Date; b=nezN2Y5w9F0oiTg00TgDkWJT/UpTTM/9xJHm1NCoB2JCSCh3bIf6rjOCZ+Dw78awF Kz1Zi+v+CVwzssgS7oq1ia2ebtT+VVf8gn0ikT13uSN1vYPAUbR2t11DrrNzETR/+q JAXe5g4OU7j0NFPEKfPHGMz4nHQQrS8eVP/o1BUE= X-ASG-Debug-ID: 1380308448-03d6a50f5ea9cf0001-6jHSXT Received: from CAS2.int.fusionio.com ([10.101.1.41]) by mx1.fusionio.com with ESMTP id QrqpxvUGi0CqVOzw (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 27 Sep 2013 13:00:48 -0600 (MDT) X-Barracuda-Envelope-From: JBacik@fusionio.com Received: from localhost (10.101.1.160) by mail.fusionio.com (10.101.1.41) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 27 Sep 2013 13:00:48 -0600 From: Josef Bacik To: Subject: [PATCH] Btrfs: do not release metadata for space cache inodes Date: Fri, 27 Sep 2013 15:00:46 -0400 X-ASG-Orig-Subj: [PATCH] Btrfs: do not release metadata for space cache inodes Message-ID: <1380308446-1252-1-git-send-email-jbacik@fusionio.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.101.1.160] X-Barracuda-Connect: UNKNOWN[10.101.1.41] X-Barracuda-Start-Time: 1380308448 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0010 1.0000 -2.0142 X-Barracuda-Spam-Score: -2.01 X-Barracuda-Spam-Status: No, SCORE=-2.01 using per-user 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.140981 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 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I've been testing our error paths and I was tripping the BUG_ON() in drop_outstanding_extent because our outstanding_extents is 0 for space cache inodes. This is because we don't reserve metadata space for these inodes since we depend on the global block reserve for our space. To fix this we need to make sure the DO_ACCOUNTING stuff doesn't actually call release_metadata for space cache inodes. With this patch I'm no longer panicing. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c462bd1..e6a0079 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1551,7 +1551,13 @@ static void btrfs_clear_bit_hook(struct inode *inode, spin_unlock(&BTRFS_I(inode)->lock); } - if (*bits & EXTENT_DO_ACCOUNTING) + /* + * We don't reserve metadata space for space cache inodes so we + * don't need to call dellalloc_release_metadata if there is an + * error. + */ + if (*bits & EXTENT_DO_ACCOUNTING && + root != root->fs_info->tree_root) btrfs_delalloc_release_metadata(inode, len); if (root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID