@@ -96,6 +96,13 @@ static long nfs_ioctl_revalidate_range(struct file *filp,
return invalidate_inode_pages2_range(filp->f_mapping, pgstart, pgend);
}
+static long nfs_ioctl_return_delegation(struct file *filp)
+{
+ struct inode *inode = filp->f_path.dentry->d_inode;
+
+ return NFS_PROTO(inode)->return_delegation(inode);
+}
+
static long nfs_ioctl_cachectl(struct file *filp, struct nfs_cachectl __user *argp)
{
u64 cmd;
@@ -113,6 +120,8 @@ static long nfs_ioctl_cachectl(struct file *filp, struct nfs_cachectl __user *ar
return nfs_ioctl_cache_revalidate(filp, false, true);
case NFS_CACHECTL_REVALIDATE_RANGE:
return nfs_ioctl_revalidate_range(filp, argp);
+ case NFS_CACHECTL_RETURN_DELEGATION:
+ return nfs_ioctl_return_delegation(filp);
}
return -EINVAL;
}
@@ -28,6 +28,7 @@
#define NFS_CACHECTL_REVALIDATE_METADATA 2
#define NFS_CACHECTL_REVALIDATE_DATA 3
#define NFS_CACHECTL_REVALIDATE_RANGE 4
+#define NFS_CACHECTL_RETURN_DELEGATION 5
struct nfs_cachectl {
u64 cmd;
Not all processes are optimised by delegations. If the file is being accessed by several clients simultaneously (or even sequentially) then performance can suffer if the server has to keep doing delegation callbacks. This ioctl allows the process to pre-emptively return the delegation and hence turn off aggressive caching of the file. It is expected that most applications that want to use this feature will do so just before the last close of the file. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> --- fs/nfs/ioctl.c | 9 +++++++++ fs/nfs/ioctl.h | 1 + 2 files changed, 10 insertions(+)