summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/libfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/libfs.c b/fs/libfs.c
index 8f2271a5df53..c18e9a1235b6 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -328,8 +328,10 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
if (new_dentry->d_inode) {
simple_unlink(new_dir, new_dentry);
- if (they_are_dirs)
+ if (they_are_dirs) {
+ drop_nlink(new_dentry->d_inode);
drop_nlink(old_dir);
+ }
} else if (they_are_dirs) {
drop_nlink(old_dir);
inc_nlink(new_dir);