summaryrefslogtreecommitdiffstats
path: root/fs/nfs/delegation.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-08 17:16:12 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-08 22:37:12 -0500
commit0032a7a749a49b2c044092a1d0af5cfd0077f35d (patch)
treeb73ca09268f9b6f1c6b5c8bb9301b088a305830d /fs/nfs/delegation.c
parent2dc317565b6fd264929b41aaa9674431d75178ef (diff)
downloadblackbird-op-linux-0032a7a749a49b2c044092a1d0af5cfd0077f35d.tar.gz
blackbird-op-linux-0032a7a749a49b2c044092a1d0af5cfd0077f35d.zip
NFS: Don't copy read delegation stateids in setattr
The server will just return an NFS4ERR_OPENMODE anyway. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r--fs/nfs/delegation.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 97d53574bf53..e27c0972f94e 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -694,21 +694,25 @@ int nfs_delegations_present(struct nfs_client *clp)
* nfs4_copy_delegation_stateid - Copy inode's state ID information
* @dst: stateid data structure to fill in
* @inode: inode to check
+ * @flags: delegation type requirement
*
- * Returns one and fills in "dst->data" * if inode had a delegation,
- * otherwise zero is returned.
+ * Returns "true" and fills in "dst->data" * if inode had a delegation,
+ * otherwise "false" is returned.
*/
-int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode)
+bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode,
+ fmode_t flags)
{
struct nfs_inode *nfsi = NFS_I(inode);
struct nfs_delegation *delegation;
- int ret = 0;
+ bool ret;
+ flags &= FMODE_READ|FMODE_WRITE;
rcu_read_lock();
delegation = rcu_dereference(nfsi->delegation);
- if (delegation != NULL) {
+ ret = (delegation != NULL && (delegation->type & flags) == flags);
+ if (ret) {
nfs4_stateid_copy(dst, &delegation->stateid);
- ret = 1;
+ nfs_mark_delegation_referenced(delegation);
}
rcu_read_unlock();
return ret;
OpenPOWER on IntegriCloud