All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. R. Okajima" <hooanon05@yahoo.co.jp>
To: Nick Piggin <npiggin@gmail.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: vfs-scale, keep the errno
Date: Fri, 14 Jan 2011 12:38:15 +0900	[thread overview]
Message-ID: <8406.1294976295@jrobl> (raw)


When open(2) without O_DIRECTORY opens an existing dir, it should return
EISDIR. In do_last(), the variable 'error' is initialized EISDIR, but it
is changed by d_revalidate() which returns any positive to represent
'the target dir is valid.'
Should we keep and return the initialized 'error' in this case.


J. R. Okajima

diff --git a/fs/namei.c b/fs/namei.c
index 5bb7588..26fa823 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2102,17 +2118,20 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
 	struct file *filp;
 	int error = -EISDIR;
 
 	switch (nd->last_type) {
 	case LAST_DOTDOT:
 		follow_dotdot(nd);
 		dir = nd->path.dentry;
 	case LAST_DOT:
 		if (need_reval_dot(dir)) {
-			error = d_revalidate(nd->path.dentry, nd);
-			if (!error)
+			int e;
+			e = d_revalidate(nd->path.dentry, nd);
+			if (!e)
 				error = -ESTALE;
-			if (error < 0)
+			if (e < 0) {
+				error = e;
 				goto exit;
+			}
 		}
 		/* fallthrough */
 	case LAST_ROOT:


             reply	other threads:[~2011-01-14  3:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14  3:38 J. R. Okajima [this message]
2011-01-14  4:01 ` vfs-scale, keep the errno Nick Piggin
2011-01-14  4:47   ` J. R. Okajima
2011-01-14 13:17   ` Hans-Peter Jansen
2011-01-14 15:26     ` Nick Piggin

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=8406.1294976295@jrobl \
    --to=hooanon05@yahoo.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@gmail.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.