diff options
author | Sage Weil <sage@newdream.net> | 2011-05-24 16:06:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-05-26 07:26:46 -0400 |
commit | 48293699a09324d2e3c66bd53d10eed6d67937a0 (patch) | |
tree | 5554ad59665d62ebc36ed16d5e13b0badea46a69 /fs/namei.c | |
parent | ea13a86463fd0c26c2c209c53dc46b8eff81bad4 (diff) |
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 <sage@newdream.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 4 |
1 files changed, 2 insertions, 2 deletions
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) | |||
2564 | return -EPERM; | 2564 | return -EPERM; |
2565 | 2565 | ||
2566 | mutex_lock(&dentry->d_inode->i_mutex); | 2566 | mutex_lock(&dentry->d_inode->i_mutex); |
2567 | dentry_unhash(dentry); | ||
2568 | if (d_mountpoint(dentry)) | 2567 | if (d_mountpoint(dentry)) |
2569 | error = -EBUSY; | 2568 | error = -EBUSY; |
2570 | else { | 2569 | else { |
2571 | error = security_inode_rmdir(dir, dentry); | 2570 | error = security_inode_rmdir(dir, dentry); |
2572 | if (!error) { | 2571 | if (!error) { |
2572 | dentry_unhash(dentry); | ||
2573 | error = dir->i_op->rmdir(dir, dentry); | 2573 | error = dir->i_op->rmdir(dir, dentry); |
2574 | if (!error) { | 2574 | if (!error) { |
2575 | dentry->d_inode->i_flags |= S_DEAD; | 2575 | dentry->d_inode->i_flags |= S_DEAD; |
2576 | dont_mount(dentry); | 2576 | dont_mount(dentry); |
2577 | } | 2577 | } |
2578 | dput(dentry); | ||
2578 | } | 2579 | } |
2579 | } | 2580 | } |
2580 | mutex_unlock(&dentry->d_inode->i_mutex); | 2581 | mutex_unlock(&dentry->d_inode->i_mutex); |
2581 | if (!error) { | 2582 | if (!error) { |
2582 | d_delete(dentry); | 2583 | d_delete(dentry); |
2583 | } | 2584 | } |
2584 | dput(dentry); | ||
2585 | 2585 | ||
2586 | return error; | 2586 | return error; |
2587 | } | 2587 | } |