summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-05-24 22:06:11 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2011-05-26 13:26:51 +0200
commit912dbc15d953791f013b0c64a8093ab0490e5f40 (patch)
tree90cdea27c906f37bfc58ba909431b709c7699879 /fs/namei.c
parentvfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems (diff)
downloadlinux-912dbc15d953791f013b0c64a8093ab0490e5f40.tar.xz
linux-912dbc15d953791f013b0c64a8093ab0490e5f40.zip
vfs: clean up vfs_rmdir
Simplify the control flow with an out label. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r--fs/namei.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/fs/namei.c b/fs/namei.c
index a1593baec0bd..18c3293411f1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2563,23 +2563,26 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
return -EPERM;
mutex_lock(&dentry->d_inode->i_mutex);
+
+ error = -EBUSY;
if (d_mountpoint(dentry))
- error = -EBUSY;
- else {
- error = security_inode_rmdir(dir, dentry);
- if (!error) {
- error = dir->i_op->rmdir(dir, dentry);
- if (!error) {
- dentry->d_inode->i_flags |= S_DEAD;
- dont_mount(dentry);
- }
- }
- }
+ goto out;
+
+ error = security_inode_rmdir(dir, dentry);
+ if (error)
+ goto out;
+
+ error = dir->i_op->rmdir(dir, dentry);
+ if (error)
+ goto out;
+
+ dentry->d_inode->i_flags |= S_DEAD;
+ dont_mount(dentry);
+
+out:
mutex_unlock(&dentry->d_inode->i_mutex);
- if (!error) {
+ if (!error)
d_delete(dentry);
- }
-
return error;
}