Bug in btrfs_rename (kernel BUG at fs/btrfs/inode.c:5595!)
diff mbox

Message ID 20100113201317.GC2774@dhcp231-156.rdu.redhat.com
State Accepted
Headers show

Commit Message

Josef Bacik Jan. 13, 2010, 8:13 p.m. UTC
None

Patch
diff mbox

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5440bab..68fc2e0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2096,6 +2096,13 @@  int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
 	 */
 	ret = btrfs_insert_orphan_item(trans, root, inode->i_ino);
 
+	printk(KERN_ERR "Btrfs: orphan add %llu\n", (unsigned long long)inode->i_ino);
+	dump_stack();
+	if (ret) {
+		printk(KERN_ERR "OH NO, ORPHAN ENTRY ALREADY EXISTS FOR %llu\n",
+		       (unsigned long long)inode->i_ino);
+	}
+
 	return ret;
 }
 
@@ -5592,7 +5599,7 @@  static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		BUG_ON(ret);
 		if (new_inode->i_nlink == 0) {
 			ret = btrfs_orphan_add(trans, new_dentry->d_inode);
-			BUG_ON(ret);
+			BUG_ON(ret && ret != -EEXIST);
 		}
 	}