On Sun, May 26, 2013 at 09:50:27PM +0800, Liu Bo wrote:
> Commit be283b2e674a09457d4563729015adb637ce7cc1
> (    Btrfs: use helper to cleanup tree roots) introduced the following bug,

Well, it did not introduce the bug, but made it visible.

> We've free'ed commit_root before actually getting to free block groups where
> caching thread needs valid extent_root->commit_root.
> 
> Signed-off-by: Liu Bo <bo.li....@oracle.com>
> ---
>  fs/btrfs/disk-io.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index e7b3cb5..a5c8f28 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3512,10 +3512,10 @@ int close_ctree(struct btrfs_root *root)
>                      percpu_counter_sum(&fs_info->delalloc_bytes));
>       }
>  
> -     free_root_pointers(fs_info, 1);
> -
>       btrfs_free_block_groups(fs_info);
>  
> +     free_root_pointers(fs_info, 1);
> +
>       del_fs_roots(fs_info);
>  
>       iput(fs_info->btree_inode);

This makes it just harder to hit, but the worker threads that get
stopped after iput may still access the freed roots, like mentioned here

http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg24239.html

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to