From: Al Viro Date: Thu, 21 Jul 2011 19:49:09 +0000 (-0400) Subject: fix IN_DELETE_SELF on overwriting rename() on ramfs et.al. X-Git-Tag: accepted/tizen/common/20141203.182822~6737^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=841590ce16c19a3ce38028adfc8b1955482ee00c;p=platform%2Fkernel%2Flinux-arm64.git 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 --- diff --git a/fs/libfs.c b/fs/libfs.c index 8f2271a..c18e9a1 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);