linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: remove useless d_unhashed() retry in d_alloc_parallel()
@ 2025-02-13 12:21 Jinliang Zheng
  2025-02-13 13:20 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Jinliang Zheng @ 2025-02-13 12:21 UTC (permalink / raw)
  To: viro, brauner, jack; +Cc: alexjlzheng, linux-fsdevel, linux-kernel

After commit 45f78b0a2743 ("fs/dcache: Move the wakeup from
__d_lookup_done() to the caller."), we will only wake up
d_wait_lookup() after adding dentry to dentry_hashtable.

Therefore, there is no need to keep retries about d_unhashed()
in d_alloc_parallel().

Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
---
 fs/dcache.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index e3634916ffb9..543833eedd8c 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2584,8 +2584,6 @@ struct dentry *d_alloc_parallel(struct dentry *parent,
 			goto mismatch;
 		if (unlikely(dentry->d_parent != parent))
 			goto mismatch;
-		if (unlikely(d_unhashed(dentry)))
-			goto mismatch;
 		if (unlikely(!d_same_name(dentry, parent, name)))
 			goto mismatch;
 		/* OK, it *is* a hashed match; return it */
-- 
2.48.1


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

* Re: [PATCH] fs: remove useless d_unhashed() retry in d_alloc_parallel()
  2025-02-13 12:21 [PATCH] fs: remove useless d_unhashed() retry in d_alloc_parallel() Jinliang Zheng
@ 2025-02-13 13:20 ` Al Viro
  2025-02-14  1:43   ` Jinliang Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2025-02-13 13:20 UTC (permalink / raw)
  To: Jinliang Zheng; +Cc: brauner, jack, alexjlzheng, linux-fsdevel, linux-kernel

On Thu, Feb 13, 2025 at 08:21:37PM +0800, Jinliang Zheng wrote:
> After commit 45f78b0a2743 ("fs/dcache: Move the wakeup from
> __d_lookup_done() to the caller."), we will only wake up
> d_wait_lookup() after adding dentry to dentry_hashtable.

Not true.  d_lookup_done() might be called without having
*ever* hashed the sucker.

Just think for a moment - what, for example, should happen
if ->lookup() fails?  Would you have d_alloc_parallel()
coming during that ->lookup() (while dentry is in in-lookup
hash) hang forever?

NAK.

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

* Re: [PATCH] fs: remove useless d_unhashed() retry in d_alloc_parallel()
  2025-02-13 13:20 ` Al Viro
@ 2025-02-14  1:43   ` Jinliang Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Jinliang Zheng @ 2025-02-14  1:43 UTC (permalink / raw)
  To: viro; +Cc: alexjlzheng, alexjlzheng, brauner, jack, linux-fsdevel,
	linux-kernel

On Thu, 13 Feb 2025 13:20:06 +0000, Al Viro wrote:
> On Thu, Feb 14, 2025 at 08:21:37PM +0800, Jinliang Zheng wrote:
> > After commit 45f78b0a2743 ("fs/dcache: Move the wakeup from
> > __d_lookup_done() to the caller."), we will only wake up
> > d_wait_lookup() after adding dentry to dentry_hashtable.
> 
> Not true.  d_lookup_done() might be called without having
> *ever* hashed the sucker.
> 
> Just think for a moment - what, for example, should happen
> if ->lookup() fails?  Would you have d_alloc_parallel()
> coming during that ->lookup() (while dentry is in in-lookup
> hash) hang forever?

Haha, yes, my bad. Thanks for pointing out my mistake.

Thank you, :)
Jinliang Zheng

> 
> NAK.

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

end of thread, other threads:[~2025-02-14  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 12:21 [PATCH] fs: remove useless d_unhashed() retry in d_alloc_parallel() Jinliang Zheng
2025-02-13 13:20 ` Al Viro
2025-02-14  1:43   ` Jinliang Zheng

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