From: Sage Weil Date: Tue, 24 May 2011 20:06:04 +0000 (-0700) Subject: vfs: dentry_unhash immediately prior to rmdir X-Git-Tag: MMI-PSA29.97-13-9~19455^2~18 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=48293699a09324d2e3c66bd53d10eed6d67937a0;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git vfs: dentry_unhash immediately prior to rmdir 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 Signed-off-by: Al Viro --- diff --git a/fs/namei.c b/fs/namei.c index 9f594312d486..af5119911704 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2564,24 +2564,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; }