summaryrefslogtreecommitdiffstats
path: root/fs/nfs/delegation.c
diff options
context:
space:
mode:
authorTrond Myklebust2006-03-20 19:44:46 +0100
committerTrond Myklebust2006-03-20 19:44:46 +0100
commit3e4f6290ca4df7464ee066123f2bca4298c2dab4 (patch)
treea8a2b32348be0df1a886ca0960112d23e1458572 /fs/nfs/delegation.c
parentNFSv4: Ensure nfs_callback_down() calls svc_destroy() (diff)
downloadkernel-qcow2-linux-3e4f6290ca4df7464ee066123f2bca4298c2dab4.tar.gz
kernel-qcow2-linux-3e4f6290ca4df7464ee066123f2bca4298c2dab4.tar.xz
kernel-qcow2-linux-3e4f6290ca4df7464ee066123f2bca4298c2dab4.zip
NFSv4: Send the delegation stateid for SETATTR calls
In the case where we hold a delegation stateid, use that in for inside SETATTR calls. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r--fs/nfs/delegation.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index c6f07c1c71e6..d3be923d4e43 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -421,3 +421,22 @@ void nfs_delegation_reap_unclaimed(struct nfs4_client *clp)
nfs_free_delegation(delegation);
}
}
+
+int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode)
+{
+ struct nfs4_client *clp = NFS_SERVER(inode)->nfs4_state;
+ struct nfs_inode *nfsi = NFS_I(inode);
+ struct nfs_delegation *delegation;
+ int res = 0;
+
+ if (nfsi->delegation_state == 0)
+ return 0;
+ spin_lock(&clp->cl_lock);
+ delegation = nfsi->delegation;
+ if (delegation != NULL) {
+ memcpy(dst->data, delegation->stateid.data, sizeof(dst->data));
+ res = 1;
+ }
+ spin_unlock(&clp->cl_lock);
+ return res;
+}