Skip to content

Commit 841590c

Browse files
author
Al Viro
committed
fix IN_DELETE_SELF on overwriting rename() on ramfs et.al.
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 <[email protected]>
1 parent ed70afc commit 841590c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/libfs.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,10 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
328328

329329
if (new_dentry->d_inode) {
330330
simple_unlink(new_dir, new_dentry);
331-
if (they_are_dirs)
331+
if (they_are_dirs) {
332+
drop_nlink(new_dentry->d_inode);
332333
drop_nlink(old_dir);
334+
}
333335
} else if (they_are_dirs) {
334336
drop_nlink(old_dir);
335337
inc_nlink(new_dir);

0 commit comments

Comments
 (0)