]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems
authorMiklos Szeredi <mszeredi@suse.cz>
Tue, 24 May 2011 20:06:10 +0000 (13:06 -0700)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 26 May 2011 11:26:50 +0000 (07:26 -0400)
commitd5f93ddf6d7ec4e08a314bff21e5a3993c38a0ed
tree93378abaf5120d5fe449ee77234368291331615a
parent2b90dcc164d3405532cb38aea3cd0c6f70a71ac3
vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems

vfs_rename_dir() doesn't properly account for filesystems with
FS_RENAME_DOES_D_MOVE.  If new_dentry has a target inode attached, it
unhashes the new_dentry prior to the rename() iop and rehashes it after,
but doesn't account for the possibility that rename() may have swapped
{old,new}_dentry.  For FS_RENAME_DOES_D_MOVE filesystems, it rehashes
new_dentry (now the old renamed-from name, which d_move() expected to go
away), such that a subsequent lookup will find it.  Currently all
FS_RENAME_DOES_D_MOVE filesystems compensate for this by failing in
d_revalidate.

The bug was introduced by: commit 4d468d3b7e02e68a45d7bdfd21bdee180f74a200
"[PATCH] Allow file systems to manually d_move() inside of ->rename()"

Fix by not rehashing the new dentry.  Rehashing used to be needed by
d_move() but isn't anymore.

Reported-by: Sage Weil <sage@newdream.net>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c