On      fri, 13 Dec 2013 17:16:22 +0800, Liu Bo wrote:
> We check if we have orphan roots when mounting btrfs, but orphan roots
> are those who are already dead and about to be freed, so don't start building
> inode cache for them, otherwise we'll get an ugly crash.
> 
> Signed-off-by: Liu Bo <[email protected]>

Acked-by: Miao Xie <[email protected]>

> ---
>  fs/btrfs/inode-map.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
> index 6c8d7bb..493694f 100644
> --- a/fs/btrfs/inode-map.c
> +++ b/fs/btrfs/inode-map.c
> @@ -141,7 +141,9 @@ static void start_caching(struct btrfs_root *root)
>       int ret;
>       u64 objectid;
>  
> -     if (!btrfs_test_opt(root, INODE_MAP_CACHE))
> +     /* Don't even start if this is an orphan root. */
> +     if (!btrfs_test_opt(root, INODE_MAP_CACHE) ||
> +         btrfs_root_refs(&root->root_item) == 0)
>               return;
>  
>       spin_lock(&root->cache_lock);
> 

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

Reply via email to