]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: run orphan cleanup on default fs root
authorJosef Bacik <josef@redhat.com>
Tue, 26 Jan 2010 14:30:53 +0000 (14:30 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 13 Aug 2010 20:20:07 +0000 (13:20 -0700)
commit e3acc2a6850efff647f1c5458524eb3a8bcba20a upstream.

This patch revert's commit

6c090a11e1c403b727a6a8eff0b97d5fb9e95cb5

Since it introduces this problem where we can run orphan cleanup on a
volume that can have orphan entries re-added.  Instead of my original
fix, Yan Zheng pointed out that we can just revert my original fix and
then run the orphan cleanup in open_ctree after we look up the fs_root.
I have tested this with all the tests that gave me problems and this
patch fixes both problems.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Acked-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/btrfs/disk-io.c
fs/btrfs/inode.c

index 009e3bd18f23d986a685c50f60e3be73a5020f31..87b25543d7d145fb90b8f986c9f9f124547430b4 100644 (file)
@@ -1993,6 +1993,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        if (!fs_info->fs_root)
                goto fail_trans_kthread;
 
+       if (!(sb->s_flags & MS_RDONLY)) {
+               down_read(&fs_info->cleanup_work_sem);
+               btrfs_orphan_cleanup(fs_info->fs_root);
+               up_read(&fs_info->cleanup_work_sem);
+       }
+
        return tree_root;
 
 fail_trans_kthread:
index 7563ea0c41804a8712ae113f581eb478d09c03be..a6d79c7731e8c58720931e53a4c8dc3a7bf93b1c 100644 (file)
@@ -3796,12 +3796,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
 
        if (location.type == BTRFS_INODE_ITEM_KEY) {
                inode = btrfs_iget(dir->i_sb, &location, root);
-               if (unlikely(root->clean_orphans) &&
-                   !(inode->i_sb->s_flags & MS_RDONLY)) {
-                       down_read(&root->fs_info->cleanup_work_sem);
-                       btrfs_orphan_cleanup(root);
-                       up_read(&root->fs_info->cleanup_work_sem);
-               }
                return inode;
        }