mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: viro@zeniv.linux.org.uk
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	hirofumi@mail.parknet.co.jp
Subject: [PATCH 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup
Date: Wed, 15 Oct 2008 22:58:11 +0900	[thread overview]
Message-ID: <f29a09483e848f5f6f3526623.ps@mail.parknet.co.jp> (raw)
In-Reply-To: <524881153e848f5f6f3426623.ps@mail.parknet.co.jp>


lookup_hash() with LOOKUP_PARENT is bogus. And this prepares to add
new intent on those path.

The user of LOOKUP_PARENT intent is nfs only, and it checks whether
nd->flags has LOOKUP_CREATE or LOOKUP_OPEN, so the result is same.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 fs/namei.c |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff -puN fs/namei.c~dcache-remove-parent fs/namei.c
--- linux-2.6/fs/namei.c~dcache-remove-parent	2008-08-26 11:13:30.000000000 +0900
+++ linux-2.6-hirofumi/fs/namei.c	2008-08-26 11:13:30.000000000 +0900
@@ -2176,16 +2176,19 @@ static long do_rmdir(int dfd, const char
 		return error;
 
 	switch(nd.last_type) {
-		case LAST_DOTDOT:
-			error = -ENOTEMPTY;
-			goto exit1;
-		case LAST_DOT:
-			error = -EINVAL;
-			goto exit1;
-		case LAST_ROOT:
-			error = -EBUSY;
-			goto exit1;
+	case LAST_DOTDOT:
+		error = -ENOTEMPTY;
+		goto exit1;
+	case LAST_DOT:
+		error = -EINVAL;
+		goto exit1;
+	case LAST_ROOT:
+		error = -EBUSY;
+		goto exit1;
 	}
+
+	nd.flags &= ~LOOKUP_PARENT;
+
 	mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
 	dentry = lookup_hash(&nd);
 	error = PTR_ERR(dentry);
@@ -2263,6 +2266,9 @@ static long do_unlinkat(int dfd, const c
 	error = -EISDIR;
 	if (nd.last_type != LAST_NORM)
 		goto exit1;
+
+	nd.flags &= ~LOOKUP_PARENT;
+
 	mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
 	dentry = lookup_hash(&nd);
 	error = PTR_ERR(dentry);
@@ -2652,6 +2658,9 @@ asmlinkage long sys_renameat(int olddfd,
 	if (newnd.last_type != LAST_NORM)
 		goto exit2;
 
+	oldnd.flags &= ~LOOKUP_PARENT;
+	newnd.flags &= ~LOOKUP_PARENT;
+
 	trap = lock_rename(new_dir, old_dir);
 
 	old_dentry = lookup_hash(&oldnd);
_

  reply	other threads:[~2008-10-15 14:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 13:58 [PATCH 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() OGAWA Hirofumi
2008-10-15 13:58 ` [PATCH 2/6] vfs: add d_ancestor() OGAWA Hirofumi
2008-10-15 13:58   ` [PATCH 3/6] vfs: add __d_instantiate() helper OGAWA Hirofumi
2008-10-15 13:58     ` [PATCH 4/6] vfs: remove unnecessary fsnotify_d_instantiate() OGAWA Hirofumi
2008-10-15 13:58       ` OGAWA Hirofumi [this message]
2008-10-15 13:58         ` [PATCH 6/6] vfs: add LOOKUP_RENAME_NEW intent OGAWA Hirofumi
2008-10-15 19:37           ` Christoph Hellwig
2008-10-15 20:13             ` OGAWA Hirofumi
2008-10-15 19:44         ` [PATCH 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup Christoph Hellwig
2008-10-15 21:43           ` OGAWA Hirofumi
2008-10-15 19:43       ` [PATCH 4/6] vfs: remove unnecessary fsnotify_d_instantiate() Christoph Hellwig
2008-10-15 20:16         ` OGAWA Hirofumi
2008-10-15 20:20           ` Christoph Hellwig
2008-10-15 19:41     ` [PATCH 3/6] vfs: add __d_instantiate() helper Christoph Hellwig
2008-10-15 20:39       ` OGAWA Hirofumi
2008-10-15 20:47         ` Trond Myklebust
2008-10-15 21:31           ` OGAWA Hirofumi
2008-10-15 19:53   ` [PATCH 2/6] vfs: add d_ancestor() Christoph Hellwig
2008-10-15 21:42     ` OGAWA Hirofumi
2008-10-15 19:45 ` [PATCH 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() Christoph Hellwig
2008-10-15 20:24   ` OGAWA Hirofumi

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=f29a09483e848f5f6f3526623.ps@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®