linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	kbuild@01.org, WeiWei Wang <wangww631@huawei.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [kbuild] [mmotm:master 57/427] fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block
Date: Tue, 30 Sep 2014 09:46:09 +0800	[thread overview]
Message-ID: <542A0B61.1020500@huawei.com> (raw)
In-Reply-To: <20140929140834.99ceb99a2bb2e0503e750ea7@linux-foundation.org>

On 2014/9/30 5:08, Andrew Morton wrote:
> On Fri, 26 Sep 2014 17:36:37 +0300 Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
>> commit: 8a09937cacc099da21313223443237cbc84d5876 [57/427] ocfs2: add orphan recovery types in ocfs2_recover_orphans
>>
>> ...
>>
>>>> fs/ocfs2/journal.c:2204:9: sparse: context imbalance in 'ocfs2_recover_orphans' - different lock contexts for basic block
>>
> 
> this?

I think there is another deadlock case in ocfs2_recover_orphans.

*spin_lock(&oi->ip_lock)*
	ocfs2_inode_lock
		ocfs2_inode_lock_full_nested
			ocfs2_inode_lock_update
				*spin_lock(&oi->ip_lock)*

Since ip_lock only wants to protect ip_flags and the added new logic
ocfs2_del_inode_from_orphan has nothing to do with it, distinguish
them.

> 
> --- a/fs/ocfs2/journal.c~ocfs2-add-orphan-recovery-types-in-ocfs2_recover_orphans-fix
> +++ a/fs/ocfs2/journal.c
> @@ -2160,8 +2160,7 @@ static int ocfs2_recover_orphans(struct
>  			ret = ocfs2_inode_lock(inode, &di_bh, 1);
>  			if (ret) {
>  				mlog_errno(ret);
> -				spin_unlock(&oi->ip_lock);
> -				goto out;
> +				goto out_unlock;
>  			}
>  			ocfs2_truncate_file(inode, di_bh, i_size_read(inode));
>  			ocfs2_inode_unlock(inode, 1);
> @@ -2173,14 +2172,13 @@ static int ocfs2_recover_orphans(struct
>  					OCFS2_INODE_DEL_FROM_ORPHAN_CREDITS);
>  			if (IS_ERR(handle)) {
>  				ret = PTR_ERR(handle);
> -				goto out;
> +				goto out_unlock;
>  			}
>  			ret = ocfs2_del_inode_from_orphan(osb, handle, inode);
>  			if (ret) {
>  				mlog_errno(ret);
>  				ocfs2_commit_trans(osb, handle);
> -				spin_unlock(&oi->ip_lock);
> -				goto out;
> +				goto out_unlock;
>  			}
>  			ocfs2_commit_trans(osb, handle);
>  		}
> @@ -2200,7 +2198,10 @@ static int ocfs2_recover_orphans(struct
>  		inode = iter;
>  	}
>  
> -out:
> +	return ret;
> +
> +out_unlock:
> +	spin_unlock(&oi->ip_lock);
>  	return ret;
>  }
>  
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 
> 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2014-09-30  1:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26 14:36 Dan Carpenter
2014-09-29 21:08 ` Andrew Morton
2014-09-30  1:46   ` Joseph Qi [this message]

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=542A0B61.1020500@huawei.com \
    --to=joseph.qi@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=hannes@cmpxchg.org \
    --cc=kbuild@01.org \
    --cc=linux-mm@kvack.org \
    --cc=wangww631@huawei.com \
    /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