Commit 9272a6ce authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Greg Kroah-Hartman

btrfs: cleanup orphans while looking up default subvolume

commit 727b9784 upstream.

Orphans in the fs tree are cleaned up via open_ctree and subvolume
orphans are cleaned via btrfs_lookup_dentry -- except when a default
subvolume is in use.  The name for the default subvolume uses a manual
lookup that doesn't trigger orphan cleanup and needs to trigger it
manually as well. This doesn't apply to the remount case since the
subvolumes are cleaned up by walking the root radix tree.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarChris Mason <clm@fb.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8d1529ce
...@@ -779,6 +779,15 @@ static struct dentry *get_default_root(struct super_block *sb, ...@@ -779,6 +779,15 @@ static struct dentry *get_default_root(struct super_block *sb,
if (btrfs_root_refs(&new_root->root_item) == 0) if (btrfs_root_refs(&new_root->root_item) == 0)
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
if (!(sb->s_flags & MS_RDONLY)) {
int ret;
down_read(&fs_info->cleanup_work_sem);
ret = btrfs_orphan_cleanup(new_root);
up_read(&fs_info->cleanup_work_sem);
if (ret)
return ERR_PTR(ret);
}
dir_id = btrfs_root_dirid(&new_root->root_item); dir_id = btrfs_root_dirid(&new_root->root_item);
setup_root: setup_root:
location.objectid = dir_id; location.objectid = dir_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment