linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Liu Bo <bo.li.liu@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/3] Btrfs: don't build inode cache for orphan root
Date: Fri, 13 Dec 2013 17:43:17 +0800	[thread overview]
Message-ID: <52AAD6B5.6030505@cn.fujitsu.com> (raw)
In-Reply-To: <1386926183-18325-3-git-send-email-bo.li.liu@oracle.com>

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@oracle.com>

Acked-by: Miao Xie <miaox@cn.fujitsu.com>

> ---
>  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);
> 


  reply	other threads:[~2013-12-13  9:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13  9:16 [PATCH 0/3] Btrfs: inode cache fixes Liu Bo
2013-12-13  9:16 ` [PATCH 1/3] Btrfs: avoid building inode cache repeatly Liu Bo
2013-12-13  9:38   ` Miao Xie
2013-12-13  9:16 ` [PATCH 2/3] Btrfs: don't build inode cache for orphan root Liu Bo
2013-12-13  9:43   ` Miao Xie [this message]
2013-12-13  9:16 ` [PATCH 3/3] Btrfs: fix EEXIST error when creating new file in subvolume/snapshot Liu Bo
2013-12-13  9:46   ` Miao Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52AAD6B5.6030505@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=bo.li.liu@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).