diff mbox

Btrfs: fix another orphan cleanup problem

Message ID 20100125210147.GB2204@localhost.localdomain (mailing list archive)
State Accepted
Headers show

Commit Message

Josef Bacik Jan. 25, 2010, 9:01 p.m. UTC
None
diff mbox

Patch

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);