Re: [PATCH 2/3] Btrfs: don't build inode cache for orphan root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <bo.li.liu@xxxxxxxxxx>

Acked-by: Miao Xie <miaox@xxxxxxxxxxxxxx>

> ---
>  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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux