kernel-ark/fs/ecryptfs
J. Bruce Fields b21996e36c locks: break delegations on unlink
We need to break delegations on any operation that changes the set of
links pointing to an inode.  Start with unlink.

Such operations also hold the i_mutex on a parent directory.  Breaking a
delegation may require waiting for a timeout (by default 90 seconds) in
the case of a unresponsive NFS client.  To avoid blocking all directory
operations, we therefore drop locks before waiting for the delegation.
The logic then looks like:

	acquire locks
	...
	test for delegation; if found:
		take reference on inode
		release locks
		wait for delegation break
		drop reference on inode
		retry

It is possible this could never terminate.  (Even if we take precautions
to prevent another delegation being acquired on the same inode, we could
get a different inode on each retry.)  But this seems very unlikely.

The initial test for a delegation happens after the lock on the target
inode is acquired, but the directory inode may have been acquired
further up the call stack.  We therefore add a "struct inode **"
argument to any intervening functions, which we use to pass the inode
back up to the caller in the case it needs a delegation synchronously
broken.

Cc: David Howells <dhowells@redhat.com>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Dustin Kirkland <dustin.kirkland@gazzang.com>
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>
2013-11-09 00:16:42 -05:00
..
crypto.c ecryptfs: avoid ctx initialization race 2013-09-06 16:58:18 -07:00
debug.c eCryptfs: update comment and debug statement 2007-10-16 09:43:11 -07:00
dentry.c ecryptfs: ->lower_path.dentry is never NULL 2013-10-24 23:34:48 -04:00
ecryptfs_kernel.h ecryptfs: get rid of ecryptfs_set_dentry_lower{,_mnt} 2013-10-24 23:34:48 -04:00
file.c file->f_op is never NULL... 2013-10-24 23:34:54 -04:00
inode.c locks: break delegations on unlink 2013-11-09 00:16:42 -05:00
Kconfig Minor code cleanups and new Kconfig option to disable /dev/ecryptfs 2013-03-07 12:47:24 -08:00
keystore.c eCryptfs: allow userspace messaging to be disabled 2013-03-03 23:59:59 -08:00
kthread.c eCryptfs: fix to use list_for_each_entry_safe() when delete items 2012-12-18 10:07:29 -06:00
main.c ecryptfs: get rid of ecryptfs_set_dentry_lower{,_mnt} 2013-10-24 23:34:48 -04:00
Makefile eCryptfs: allow userspace messaging to be disabled 2013-03-03 23:59:59 -08:00
messaging.c eCryptfs: Cocci spatch "memdup.spatch" 2013-06-07 17:26:55 -07:00
miscdev.c ecryptfs: close rmmod race 2013-04-09 14:08:16 -04:00
mmap.c eCryptfs: Avoid unnecessary disk read and data decryption during writing 2012-11-07 17:56:16 -08:00
read_write.c ecryptfs: don't open-code kernel_read() 2013-05-09 13:39:58 -04:00
super.c vfs: Rename end_writeback() to clear_inode() 2012-05-06 13:43:41 +08:00