diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-09-20 09:14:34 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-11-09 00:16:42 -0500 |
commit | b21996e36c8e3b92a84e972378bde80b43acd890 (patch) | |
tree | 0ed5eb8a3d11434ad6aa9c7efe24823bdb52b1e7 /fs/cachefiles | |
parent | 9accbb977ab78234b8f298df5f306ed08d06bedb (diff) |
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>
Diffstat (limited to 'fs/cachefiles')
-rw-r--r-- | fs/cachefiles/namei.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index f4a08d7fa2f7..31d480c0e046 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -294,7 +294,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache, | |||
294 | if (ret < 0) { | 294 | if (ret < 0) { |
295 | cachefiles_io_error(cache, "Unlink security error"); | 295 | cachefiles_io_error(cache, "Unlink security error"); |
296 | } else { | 296 | } else { |
297 | ret = vfs_unlink(dir->d_inode, rep); | 297 | ret = vfs_unlink(dir->d_inode, rep, NULL); |
298 | 298 | ||
299 | if (preemptive) | 299 | if (preemptive) |
300 | cachefiles_mark_object_buried(cache, rep); | 300 | cachefiles_mark_object_buried(cache, rep); |