linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, npiggin@kernel.dk, zyan@redhat.com,
	hartleys@visionengravers.com, Yanxiaodan <yanxiaodan@huawei.com>,
	Mingfangsen <mingfangsen@huawei.com>,
	"wubo (T)" <wubo40@huawei.com>
Subject: Re: [PATCH] dcache: unlock inode->i_lock before goto restart tag in, d_prune_aliases
Date: Wed, 15 Apr 2020 18:46:48 -0700	[thread overview]
Message-ID: <20200416014648.GB816@sol.localdomain> (raw)
In-Reply-To: <c3a3d3d2-dad4-a4fe-014f-3f5eb3561524@huawei.com>

On Wed, Apr 15, 2020 at 09:20:33PM +0800, Zhiqiang Liu wrote:
> From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
> 
> coccicheck reports:
>   fs/dcache.c:1027:1-10: second lock on line 1027
> 
> In d_prune_aliases, before goto restart we should unlock
> inode->i_lock.
> 
> Fixes: 29355c3904e ("d_prune_alias(): just lock the parent and call __dentry_kill()")
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
> Signed-off-by: Feilong Lin <linfeilong@huawei.com>
> ---
>  fs/dcache.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index b280e07e162b..1532ebe9d9ca 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -1030,6 +1030,7 @@ void d_prune_aliases(struct inode *inode)
>  		if (!dentry->d_lockref.count) {
>  			struct dentry *parent = lock_parent(dentry);
>  			if (likely(!dentry->d_lockref.count)) {
> +				spin_unlock(&inode->i_lock);
>  				__dentry_kill(dentry);
>  				dput(parent);
>  				goto restart;
> -- 

Doesn't __dentry_kill() already do the unlock, via dentry_unlink_inode()?

- Eric

  reply	other threads:[~2020-04-16  1:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 13:20 [PATCH] dcache: unlock inode->i_lock before goto restart tag in, d_prune_aliases Zhiqiang Liu
2020-04-16  1:46 ` Eric Biggers [this message]
2020-04-16  1:52   ` Zhiqiang Liu

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=20200416014648.GB816@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=hartleys@visionengravers.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=mingfangsen@huawei.com \
    --cc=npiggin@kernel.dk \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wubo40@huawei.com \
    --cc=yanxiaodan@huawei.com \
    --cc=zyan@redhat.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;
as well as URLs for NNTP newsgroup(s).