]> git.karo-electronics.de Git - karo-tx-linux.git/commit
vfs: take i_mutex on renamed file
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 9 Mar 2012 22:29:28 +0000 (17:29 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 14 Apr 2012 04:42:44 +0000 (00:42 -0400)
commit8792bd83c020680726d21e34d6f6e6570217038e
treefb72ee6b9c34634c942e5c465a327d7dc576605b
parente847469bf77a1d339274074ed068d461f0c872bc
vfs: take i_mutex on renamed file

A read delegation is used by NFSv4 as a guarantee that a client can
perform local read opens without informing the server.

The open operation takes the last component of the pathname as an
argument, thus is also a lookup operation, and giving the client the
above guarantee means informing the client before we allow anything that
would change the set of names pointing to the inode.

Therefore, we need to break delegations on rename, link, and unlink.

We also need to prevent new delegations from being acquired while one of
these operations is in progress.

We could add some completely new locking for that purpose, but it's
simpler to use the i_mutex, since that's already taken by all the
operations we care about.

The single exception is rename.  So, modify rename to take the i_mutex
on the file that is being renamed.

Also fix up lockdep and Documentation/filesystems/directory-locking to
reflect the change.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Documentation/filesystems/directory-locking
fs/namei.c
include/linux/fs.h