diff --git a/fs/minix/namei.c b/fs/minix/namei.c index 937fa5fae2b8..f20c28da1035 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -227,6 +227,10 @@ static int minix_rename(struct user_namespace *mnt_userns, new_inode->i_ctime = current_time(new_inode); if (dir_de) drop_nlink(new_inode); + + if (new_inode->i_nlink == 0) + goto out_dir; + inode_dec_link_count(new_inode); } else { err = minix_add_link(new_dentry, old_inode);