From: Al Viro <viro@zeniv.linux.org.uk>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] fscrypt: cache decrypted symlink target in ->i_link
Date: Wed, 10 Apr 2019 02:39:34 +0100 [thread overview]
Message-ID: <20190410013934.GV2217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20190410012247.GB2454@sol.localdomain>
On Tue, Apr 09, 2019 at 06:22:49PM -0700, Eric Biggers wrote:
> > Non-NULL ->get_link() => DCACHE_SYMLINK_TYPE in ->d_flags =>
> > d_is_symlink() true => step_into() progresses to pick_link().
> >
> > IOW, non-NULL ->get_link() is what tells you that we have
> > a symlink there.
>
> I think that's pretty unintuitive. The fact that multiple filesystems including
> ext4 set ->i_link on fast symlinks, then set ->get_link() to a function that
> returns ->i_link, made me assume that's the mechanism by which such symlink
> targets are returned to the VFS. When in fact fs/namei.c just uses ->i_link,
> and never calls ->get_link().
>
> Is there any reason why d_flags_for_inode() doesn't check S_ISLNK() instead, and
> then fs/namei.c would call ->get_link() if non-NULL, otherwise use ->i_link?
Extra check and dereference on hot path with no visible benefits of doing it
that way, for starters. Really, what _is_ the benefit of pessimizing that?
Most of the symlinks we run into will have ->i_link set; checking ->i_op->get_link
first is extra work for no good reason...
What's more, ->get_link is visible in inode_operations; ->i_link (let alone ->i_mode)
isn't. As it is, we can easily tell symlink inode_operations from everything else
on the source level. With your scheme we won't.
WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@zeniv.linux.org.uk>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-fscrypt@vger.kernel.org,
linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] fscrypt: cache decrypted symlink target in ->i_link
Date: Wed, 10 Apr 2019 02:39:34 +0100 [thread overview]
Message-ID: <20190410013934.GV2217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20190410012247.GB2454@sol.localdomain>
On Tue, Apr 09, 2019 at 06:22:49PM -0700, Eric Biggers wrote:
> > Non-NULL ->get_link() => DCACHE_SYMLINK_TYPE in ->d_flags =>
> > d_is_symlink() true => step_into() progresses to pick_link().
> >
> > IOW, non-NULL ->get_link() is what tells you that we have
> > a symlink there.
>
> I think that's pretty unintuitive. The fact that multiple filesystems including
> ext4 set ->i_link on fast symlinks, then set ->get_link() to a function that
> returns ->i_link, made me assume that's the mechanism by which such symlink
> targets are returned to the VFS. When in fact fs/namei.c just uses ->i_link,
> and never calls ->get_link().
>
> Is there any reason why d_flags_for_inode() doesn't check S_ISLNK() instead, and
> then fs/namei.c would call ->get_link() if non-NULL, otherwise use ->i_link?
Extra check and dereference on hot path with no visible benefits of doing it
that way, for starters. Really, what _is_ the benefit of pessimizing that?
Most of the symlinks we run into will have ->i_link set; checking ->i_op->get_link
first is extra work for no good reason...
What's more, ->get_link is visible in inode_operations; ->i_link (let alone ->i_mode)
isn't. As it is, we can easily tell symlink inode_operations from everything else
on the source level. With your scheme we won't.
next prev parent reply other threads:[~2019-04-10 1:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 23:35 [PATCH] fscrypt: cache decrypted symlink target in ->i_link Eric Biggers
2019-04-09 23:35 ` [f2fs-dev] " Eric Biggers
2019-04-10 0:33 ` Al Viro
2019-04-10 0:33 ` Al Viro
2019-04-10 0:45 ` Eric Biggers
2019-04-10 0:45 ` Eric Biggers
2019-04-10 1:04 ` Al Viro
2019-04-10 1:04 ` Al Viro
2019-04-10 1:22 ` Eric Biggers
2019-04-10 1:22 ` [f2fs-dev] " Eric Biggers
2019-04-10 1:22 ` Eric Biggers
2019-04-10 1:39 ` Al Viro [this message]
2019-04-10 1:39 ` Al Viro
2019-04-10 2:58 ` Eric Biggers
2019-04-10 2:58 ` Eric Biggers
2019-04-10 3:44 ` Al Viro
2019-04-10 3:44 ` Al Viro
2019-04-10 4:04 ` Eric Biggers
2019-04-10 4:04 ` [f2fs-dev] " Eric Biggers
2019-04-10 4:04 ` Eric Biggers
2019-04-10 4:16 ` Eric Biggers
2019-04-10 4:31 ` Al Viro
2019-04-10 4:31 ` Al Viro
2019-04-10 5:04 ` Eric Biggers
2019-04-10 5:04 ` [f2fs-dev] " Eric Biggers
2019-04-10 5:04 ` Eric Biggers
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=20190410013934.GV2217@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=ebiggers@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/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.