Commit 912dbc15d953791f013b0c64a8093ab0490e5f40
Committed by
Al Viro
1 parent
b5afd2c406
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 17 additions and 14 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -2563,23 +2563,26 @@ |
2563 | 2563 | return -EPERM; |
2564 | 2564 | |
2565 | 2565 | mutex_lock(&dentry->d_inode->i_mutex); |
2566 | + | |
2567 | + error = -EBUSY; | |
2566 | 2568 | if (d_mountpoint(dentry)) |
2567 | - error = -EBUSY; | |
2568 | - else { | |
2569 | - error = security_inode_rmdir(dir, dentry); | |
2570 | - if (!error) { | |
2571 | - error = dir->i_op->rmdir(dir, dentry); | |
2572 | - if (!error) { | |
2573 | - dentry->d_inode->i_flags |= S_DEAD; | |
2574 | - dont_mount(dentry); | |
2575 | - } | |
2576 | - } | |
2577 | - } | |
2569 | + goto out; | |
2570 | + | |
2571 | + error = security_inode_rmdir(dir, dentry); | |
2572 | + if (error) | |
2573 | + goto out; | |
2574 | + | |
2575 | + error = dir->i_op->rmdir(dir, dentry); | |
2576 | + if (error) | |
2577 | + goto out; | |
2578 | + | |
2579 | + dentry->d_inode->i_flags |= S_DEAD; | |
2580 | + dont_mount(dentry); | |
2581 | + | |
2582 | +out: | |
2578 | 2583 | mutex_unlock(&dentry->d_inode->i_mutex); |
2579 | - if (!error) { | |
2584 | + if (!error) | |
2580 | 2585 | d_delete(dentry); |
2581 | - } | |
2582 | - | |
2583 | 2586 | return error; |
2584 | 2587 | } |
2585 | 2588 |