From patchwork Thu Feb 7 21:28:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2113441 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 97AA83FDF1 for ; Thu, 7 Feb 2013 21:21:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759392Ab3BGVVw (ORCPT ); Thu, 7 Feb 2013 16:21:52 -0500 Received: from dkim1.fusionio.com ([66.114.96.53]:54467 "EHLO dkim1.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759330Ab3BGVVw (ORCPT ); Thu, 7 Feb 2013 16:21:52 -0500 Received: from mx2.fusionio.com (unknown [10.101.1.160]) by dkim1.fusionio.com (Postfix) with ESMTP id C43987C04D5 for ; Thu, 7 Feb 2013 14:21:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1360272111; bh=HcMC+XHSpD9WztEqgLNrRES+/Teb8nzH5Mjwrg6gMmM=; h=From:To:Subject:Date; b=QUL1wtciokzCFNVSJuL3NWMMjIcbhrIQP4oMzIpVopxVcSnu74ryPmdMGUnXguCli 9r7J9KC8N5x2U1j4rSRBRetNSRD/7zL3Hh8mGKvp/NfAo1aYcojCXygvtp7seHMZzk BCzYLIxqHUgACzm9RBc3wmFjViFYvRDx541GR+bI= X-ASG-Debug-ID: 1360272111-0421b51e7005180001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx2.fusionio.com with ESMTP id KyAReRvEvPLkPZcF (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 07 Feb 2013 14:21:51 -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; Thu, 7 Feb 2013 14:21:50 -0700 From: Josef Bacik To: Subject: [PATCH] Btrfs: cleanup orphan reservation if truncate fails Date: Thu, 7 Feb 2013 16:28:44 -0500 X-ASG-Orig-Subj: [PATCH] Btrfs: cleanup orphan reservation if truncate fails Message-ID: <1360272524-19548-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: 1360272111 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.122103 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 I noticed we were getting lots of warnings with xfstest 83 because we have reservations outstanding. This is because we moved the orphan add outside of the truncate, but we don't actually cleanup our reservation if something fails. This fixes the problem and I no longer see warnings. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/inode.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 73e9409..905297f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2538,6 +2538,8 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) goto out; ret = btrfs_truncate(inode); + if (ret) + btrfs_orphan_del(NULL, inode); } else { nr_unlink++; }