linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	dwysocha@redhat.com
Subject: Re: [PATCH] vfs: remove unneeded permission check from path_init
Date: Wed, 12 Dec 2012 18:40:49 +0000	[thread overview]
Message-ID: <20121212184049.GO4939@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1355234176-767-1-git-send-email-jlayton@redhat.com>

On Tue, Dec 11, 2012 at 08:56:16AM -0500, Jeff Layton wrote:
> When path_init is called with a valid dfd, that code checks permissions
> on the open directory fd and returns an error if the check fails. This
> permission check is redundant, however.
> 
> Both callers of path_init immediately call link_path_walk afterward. The
> first thing that link_path_walk does is to check for exec permissions
> at the starting point of the path walk.
> 
> In most cases, these checks are very quick, but when the dfd is for a
> file on a NFS mount with the actimeo=0, each permission check goes
> out onto the wire. The result is 2 identical ACCESS calls.
> 
> Given that these codepaths are fairly "hot", I think it makes sense to
> eliminate the permission check in path_init and simply assume that the
> caller will eventually check the permissions before proceeding.

Applied, with one modification to commit message - the second paragraph
replaced with

Both callers of path_init immediately call link_path_walk afterward. The
first thing that link_path_walk does for pathnames that do not consist
only of slashes is to check for exec permissions at the starting point of
the path walk.  And this check in path_init() is on the path taken only
when *name != '/' && *name != '\0'.

      reply	other threads:[~2012-12-12 18:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11 13:56 [PATCH] vfs: remove unneeded permission check from path_init Jeff Layton
2012-12-12 18:40 ` Al Viro [this message]

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=20121212184049.GO4939@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=dwysocha@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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 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).