mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sage Weil <sage@newdream.net>
To: viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mszeredi@suse.cz,
	Sage Weil <sage@newdream.net>
Subject: [PATCH 1/7] vfs: dentry_unhash immediately prior to rmdir
Date: Wed, 30 Mar 2011 15:09:22 -0700	[thread overview]
Message-ID: <1301522968-4382-2-git-send-email-sage@newdream.net> (raw)
In-Reply-To: <1301522968-4382-1-git-send-email-sage@newdream.net>

This presumes that there is no reason to unhash a dentry if we fail because
it is a mountpoint or the LSM check fails, and that the LSM checks do not
depend on the dentry being unhashed.

Signed-off-by: Sage Weil <sage@newdream.net>
---
 fs/namei.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index a4689eb..f47a5c0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2838,24 +2838,24 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
 		return -EPERM;
 
 	mutex_lock(&dentry->d_inode->i_mutex);
-	dentry_unhash(dentry);
 	if (d_mountpoint(dentry))
 		error = -EBUSY;
 	else {
 		error = security_inode_rmdir(dir, dentry);
 		if (!error) {
+			dentry_unhash(dentry);
 			error = dir->i_op->rmdir(dir, dentry);
 			if (!error) {
 				dentry->d_inode->i_flags |= S_DEAD;
 				dont_mount(dentry);
 			}
+			dput(dentry);
 		}
 	}
 	mutex_unlock(&dentry->d_inode->i_mutex);
 	if (!error) {
 		d_delete(dentry);
 	}
-	dput(dentry);
 
 	return error;
 }
-- 
1.7.0


  reply	other threads:[~2011-03-30 22:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30 22:09 [PATCH 0/7] Do not dentry_unhash() in VFS Sage Weil
2011-03-30 22:09 ` Sage Weil [this message]
2011-03-30 22:09 ` [PATCH 2/7] vfs: remove dget() from dentry_unhash() Sage Weil
2011-03-30 22:09 ` [PATCH 3/7] vfs: push dentry_unhash on rmdir into file systems Sage Weil
2011-03-30 22:09 ` [PATCH 4/7] vfs: push dentry_unhash on rename_dir " Sage Weil
2011-03-31  3:09   ` Dave Chinner
2011-03-31  4:40     ` Sage Weil
2011-03-30 22:09 ` [PATCH 5/7] vfs: update dentry_unhash() comment Sage Weil
2011-03-30 22:09 ` [PATCH 6/7] libfs: drop unneeded dentry_unhash Sage Weil
2011-03-30 22:09 ` [PATCH 7/7] vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems Sage Weil

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=1301522968-4382-2-git-send-email-sage@newdream.net \
    --to=sage@newdream.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --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®