From patchwork Mon Jan 25 21:01:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 75096 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0PL22Cb004838 for ; Mon, 25 Jan 2010 21:02:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753428Ab0AYVBt (ORCPT ); Mon, 25 Jan 2010 16:01:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753420Ab0AYVBt (ORCPT ); Mon, 25 Jan 2010 16:01:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1025 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752747Ab0AYVBs (ORCPT ); Mon, 25 Jan 2010 16:01:48 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0PL1mQK011231 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Jan 2010 16:01:48 -0500 Received: from localhost.localdomain (vpn-10-121.rdu.redhat.com [10.11.10.121]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0PL1laZ002390 for ; Mon, 25 Jan 2010 16:01:48 -0500 Date: Mon, 25 Jan 2010 16:01:47 -0500 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: fix another orphan cleanup problem Message-ID: <20100125210147.GB2204@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c7fbfaa..067f4b5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2202,6 +2202,17 @@ void btrfs_orphan_cleanup(struct btrfs_root *root) * the proper thing when we hit it */ spin_lock(&root->list_lock); + if (!list_empty(&BTRFS_I(inode)->i_orphan)) { + /* + * This inode is on the in-memory list, which means we + * shouldn't be cleaning it up, move on to the next + * orphan item. + */ + spin_unlock(&root->list_lock); + key.offset = inode->i_ino - 1; + iput(inode); + continue; + } list_add(&BTRFS_I(inode)->i_orphan, &root->orphan_list); spin_unlock(&root->list_lock);