From 72b1deb9f281e0fae646edbd302fc4e357951d67 Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 3 Apr 2009 16:42:44 +0100 Subject: [PATCH] --- yaml --- r: 140223 b: refs/heads/master c: 1fcdf534885b65e6d39780a5a89e9dfc5431cf68 h: refs/heads/master i: 140221: e9254b910fd60b772cfb41bf30121e1eaa5bc46a 140219: 3f9c7b0ea3752af383eddabf450c72b19a090a96 140215: 126ea1e3f3046aa29f6c59cc2912918dea41634c 140207: a8c6d23d1f89e2a6972c863aa98bf37468f334d4 140191: 1997a2b4942fdfa25f83cc4968c267c7e779d028 140159: 8e0578365057642ce232c0d36c088f838e6c6aba v: v3 --- [refs] | 2 +- trunk/fs/nfs/fscache-index.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 1808e3ddcb6d..f9736e0ae058 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 545db45f0fc0d4203b045047798ce156972a3056 +refs/heads/master: 1fcdf534885b65e6d39780a5a89e9dfc5431cf68 diff --git a/trunk/fs/nfs/fscache-index.c b/trunk/fs/nfs/fscache-index.c index a119b5691e7c..5b1006480bc2 100644 --- a/trunk/fs/nfs/fscache-index.c +++ b/trunk/fs/nfs/fscache-index.c @@ -291,6 +291,30 @@ static void nfs_fscache_inode_now_uncached(void *cookie_netfs_data) } } +/* + * Get an extra reference on a read context. + * - This function can be absent if the completion function doesn't require a + * context. + * - The read context is passed back to NFS in the event that a data read on the + * cache fails with EIO - in which case the server must be contacted to + * retrieve the data, which requires the read context for security. + */ +static void nfs_fh_get_context(void *cookie_netfs_data, void *context) +{ + get_nfs_open_context(context); +} + +/* + * Release an extra reference on a read context. + * - This function can be absent if the completion function doesn't require a + * context. + */ +static void nfs_fh_put_context(void *cookie_netfs_data, void *context) +{ + if (context) + put_nfs_open_context(context); +} + /* * Define the inode object for FS-Cache. This is used to describe an inode * object to fscache_acquire_cookie(). It is keyed by the NFS file handle for @@ -308,4 +332,6 @@ const struct fscache_cookie_def nfs_fscache_inode_object_def = { .get_aux = nfs_fscache_inode_get_aux, .check_aux = nfs_fscache_inode_check_aux, .now_uncached = nfs_fscache_inode_now_uncached, + .get_context = nfs_fh_get_context, + .put_context = nfs_fh_put_context, };