Skip to content

Commit

Permalink
Btrfs: run orphan cleanup on default fs root
Browse files Browse the repository at this point in the history
This patch revert's commit

6c090a1

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>
  • Loading branch information
Josef Bacik authored and Chris Mason committed Jan 28, 2010
1 parent f858153 commit e3acc2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 6 additions & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3797,12 +3797,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;
}

Expand Down

0 comments on commit e3acc2a

Please sign in to comment.