Message ID | a2ff95d73e0ccec4703c1f4d0b9af4c1a19fe4e2.1443889301.git.zhaolei@cn.fujitsu.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Hi, On Sun, Oct 04, 2015 at 12:28:39AM +0800, Zhao Lei wrote: > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c > index 79a5bd9..c05b975 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -10010,8 +10010,18 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) > block_group = list_first_entry(&fs_info->unused_bgs, > struct btrfs_block_group_cache, > bg_list); > - space_info = block_group->space_info; > list_del_init(&block_group->bg_list); > + > + space_info = block_group->space_info; > + > + down_read(&space_info->groups_sem); Thanks for reworking this, are there other patches that I'm missing that are meant to go in before this one? The down_read() this patch adds is inside a spinlock(). -chris -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 79a5bd9..c05b975 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -10010,8 +10010,18 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) block_group = list_first_entry(&fs_info->unused_bgs, struct btrfs_block_group_cache, bg_list); - space_info = block_group->space_info; list_del_init(&block_group->bg_list); + + space_info = block_group->space_info; + + down_read(&space_info->groups_sem); + if (list_is_singular(&block_group->list)) { + up_read(&space_info->groups_sem); + btrfs_put_block_group(block_group); + continue; + } + up_read(&space_info->groups_sem); + if (ret || btrfs_mixed_space_info(space_info)) { btrfs_put_block_group(block_group); continue;