From: "J. R. Okajima" <hooanon05g@gmail.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Q: spin_unlock(dentry) after lock_parent(dentry)
Date: Thu, 05 Jun 2014 02:03:08 +0900 [thread overview]
Message-ID: <8257.1401901388@jrobl> (raw)
In-Reply-To: <20140603231712.GU18016@ZenIV.linux.org.uk>
Al Viro:
> Nope. You are misreading it. Note that in *all* cases the parent is
> locked. And NULL is returned exactly in the case when that parent is
:::
Thanks.
Please allow me another question.
In the case of concurrent dentry_kill() and shrink_dentry_list(),
dentry_kill() kills the dentry and calls list_del(&dentry->d_u.d_child).
lock_parent() (called by shrink_dentry_list()) doesn't check d_child
nor DCACHE_DENTRY_KILLED. So shrink_dentry_list() may get a parent of a
dead dentry and tries traversing via d_parent.
Is it correct to track d_parent after list_del(&dentry->d_u.d_child)?
Should lock_parent() consider DCACHE_DENTRY_KILLED too?
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -533,7 +533,8 @@ failed:
static inline struct dentry *lock_parent(struct dentry *dentry)
{
struct dentry *parent = dentry->d_parent;
- if (IS_ROOT(dentry))
+ if (IS_ROOT(dentry)
+ || (dentry->d_flags & DCACHE_DENTRY_KILLED))
return NULL;
if (likely(spin_trylock(&parent->d_lock)))
return parent;
J. R. Okajima
next prev parent reply other threads:[~2014-06-04 17:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 14:36 Q: spin_unlock(dentry) after lock_parent(dentry) J. R. Okajima
2014-06-03 23:17 ` Al Viro
2014-06-04 17:03 ` J. R. Okajima [this message]
2014-06-07 13:51 ` J. R. Okajima
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=8257.1401901388@jrobl \
--to=hooanon05g@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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).