restore pinning the victim dentry in vfs_rmdir()/vfs_rename_dir()
authorAl Viro <viro@ZenIV.linux.org.uk>
Wed, 14 Sep 2011 17:55:41 +0000 (18:55 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 3 Oct 2011 18:40:30 +0000 (11:40 -0700)
commit97abc52eb26f2ae8d033100c4c024e6138bdfd60
tree660d97e12cbb27d4b725429d1e17b84af0d0e1c5
parenta4f5172f4f84d22889d97c527cd8fe7430f075ae
restore pinning the victim dentry in vfs_rmdir()/vfs_rename_dir()

commit 1d2ef5901483004d74947bbf78d5146c24038fe7 upstream.

We used to get the victim pinned by dentry_unhash() prior to commit
64252c75a219 ("vfs: remove dget() from dentry_unhash()") and ->rmdir()
and ->rename() instances relied on that; most of them don't care, but
ones that used d_delete() themselves do.  As the result, we are getting
rmdir() oopses on NFS now.

Just grab the reference before locking the victim and drop it explicitly
after unlocking, same as vfs_rename_other() does.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Simon Kirby <sim@hostway.ca>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/namei.c