Commit 3202310e authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Luis Henriques

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 avatarLuis Henriques <luis.henriques@canonical.com>
parent 9ee6babb
......@@ -902,6 +902,15 @@ static struct dentry *get_default_root(struct super_block *sb,
if (IS_ERR(new_root))
return ERR_CAST(new_root);
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);
setup_root:
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