]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: take i_mutex on renamed file
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 5 Mar 2012 16:40:41 +0000 (11:40 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 9 Nov 2013 05:16:40 +0000 (00:16 -0500)
commit98d90592f1f0a73756abdc301368be996df15df2
tree740e74df27113d34d06da011b3c5561d19eb3349
parent6c439ea9ce9e29dd5c291057bea18d7bdeb42375
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.

Acked-by: Jeff Layton <jlayton@redhat.com>
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