From: Al Viro <viro@ZenIV.linux.org.uk>
To: shyodx1989 <shyodx1989@163.com>
Cc: linux-fsdevel@vger.kernel.org, zhangshiming5@huawei.com,
yuchao0@huawei.com, jaegeuk@kernel.org
Subject: Re: Question: d_revalidate in rcu-walk
Date: Sat, 3 Sep 2016 14:03:12 +0100 [thread overview]
Message-ID: <20160903130312.GC2356@ZenIV.linux.org.uk> (raw)
In-Reply-To: <60d375df.47a9.156efa7c83a.Coremail.shyodx1989@163.com>
On Sat, Sep 03, 2016 at 06:46:05PM +0800, shyodx1989 wrote:
>
> But most filesystems, which have d_revalidate, return -ECHILD if LOOKUP_RCU is set instead of
> checking if it is safe for rcu-walk.
For a good and simple reason that the work they would have to do in their
->d_revalidate() can't be done without blocking. Which can't be done under
rcu_read_lock(), thus the "sorry, you have to leave RCU mode for that", aka
-ECHILD.
>However commit 5c0f360b083fb33d05d1bff4b138b82d715eb419
> "jfs_ci_revalidate() is safe from RCU mode" removes the check. So why is jfs_ci_revalidate safe in
> RCU mode
Because JFS ->d_revalidate() doesn't need anything blocking.
> and if we only check d_inode (like the following code), what should we care about to
> tell if d_revalidate is safe for rcu-walk or not and? Ref-walk is much slower than rcu-walk, maybe
> it's better not to return -ECHILD directly if not necessary.
>
>
> d_revalidate(dentry, flags)
> {
> if (flags & LOOKUP_RCU)
> return -ECHILD
> if (!d_inode_rcu(dentry))
> return 0;
> return 1;
> }
Huh? Which filesystem would that be? Sure, in such case -ECHILD is pointless;
who does that? Some of them might be possible to drop ECHILD, but that needs
some care. Note, BTW, that things like dput() are blocking, so the things like
trying to grab parent, etc. can get tricky.
Which ->d_revalidate() instance do you have in mind?
next prev parent reply other threads:[~2016-09-03 13:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <60d375df.47a9.156efa7c83a.Coremail.shyodx1989@163.com>
2016-09-03 12:23 ` Question: d_revalidate in rcu-walk shyodx1989
2016-09-03 13:03 ` Al Viro [this message]
2016-09-04 8:14 ` shyodx1989
2016-09-04 8:46 ` Sheng Yong
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=20160903130312.GC2356@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=jaegeuk@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=shyodx1989@163.com \
--cc=yuchao0@huawei.com \
--cc=zhangshiming5@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.