linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dcache: unlock inode->i_lock before goto restart tag in, d_prune_aliases
@ 2020-04-15 13:20 Zhiqiang Liu
  2020-04-16  1:46 ` Eric Biggers
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiqiang Liu @ 2020-04-15 13:20 UTC (permalink / raw)
  To: viro, linux-fsdevel, linux-kernel
  Cc: npiggin, zyan, hartleys, Yanxiaodan, Mingfangsen, wubo (T)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dcache: unlock inode->i_lock before goto restart tag in, d_prune_aliases
  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
  2020-04-16  1:52   ` Zhiqiang Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2020-04-16  1:46 UTC (permalink / raw)
  To: Zhiqiang Liu
  Cc: viro, linux-fsdevel, linux-kernel, npiggin, zyan, hartleys,
	Yanxiaodan, Mingfangsen, wubo (T)

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dcache: unlock inode->i_lock before goto restart tag in, d_prune_aliases
  2020-04-16  1:46 ` Eric Biggers
@ 2020-04-16  1:52   ` Zhiqiang Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Zhiqiang Liu @ 2020-04-16  1:52 UTC (permalink / raw)
  To: Eric Biggers
  Cc: viro, linux-fsdevel, linux-kernel, npiggin, zyan, hartleys,
	Yanxiaodan, Mingfangsen, wubo (T)

On 2020/4/16 9:46, Eric Biggers wrote:
> 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
> 
Yes, you are right. Sorry for that. Please ignore this patch.
> .
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-16  1:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-04-16  1:52   ` Zhiqiang Liu

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