Skip to content

Commit

Permalink
vfs: clean up vfs_rmdir
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sage Weil authored and Al Viro committed May 26, 2011
1 parent b5afd2c commit 912dbc1
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 912dbc1

Please sign in to comment.