Skip to content

Commit

Permalink
fix IN_DELETE_SELF on overwriting rename() on ramfs et.al.
Browse files Browse the repository at this point in the history
On ramfs and other simple_rename() users IN_DELETE_SELF is not generated
for victim of overwriting rename() if it's is a directory.  Works on
most of the local filesystems and really trivial to fix...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jul 22, 2011
1 parent ed70afc commit 841590c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 841590c

Please sign in to comment.