From patchwork Fri Mar 4 19:11:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 609911 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p24JMoqk030504 for ; Fri, 4 Mar 2011 19:22:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760059Ab1CDTWj (ORCPT ); Fri, 4 Mar 2011 14:22:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49082 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760089Ab1CDTW0 (ORCPT ); Fri, 4 Mar 2011 14:22:26 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p24JMQrP032722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 4 Mar 2011 14:22:26 -0500 Received: from test1244.test.redhat.com (test1244.test.redhat.com [10.10.10.244]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p24JMPS4007976 for ; Fri, 4 Mar 2011 14:22:25 -0500 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: make sure to remove the orphan item from the in-memory list Date: Fri, 4 Mar 2011 14:11:30 -0500 Message-Id: <1299265890-20517-1-git-send-email-josef@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 04 Mar 2011 19:22:51 +0000 (UTC) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 69df7c8..7a5bb9e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6587,6 +6587,12 @@ static int btrfs_truncate(struct inode *inode) ret = btrfs_orphan_del(trans, inode); if (ret) err = ret; + } else if (ret && inode->i_nlink > 0) { + /* + * Failed to do the truncate, remove us from the in memory + * orphan list. + */ + ret = btrfs_orphan_del(NULL, inode); } ret = btrfs_update_inode(trans, root, inode);