Commit 4d1b0c33 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Jiri Slaby

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 avatarJiri Slaby <jslaby@suse.cz>
parent 9cb9cfc9
......@@ -834,6 +834,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