aboutsummaryrefslogtreecommitdiffstats
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)
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)
694 * nfs4_copy_delegation_stateid - Copy inode's state ID information 694 * nfs4_copy_delegation_stateid - Copy inode's state ID information
695 * @dst: stateid data structure to fill in 695 * @dst: stateid data structure to fill in
696 * @inode: inode to check 696 * @inode: inode to check
697 * @flags: delegation type requirement
697 * 698 *
698 * Returns one and fills in "dst->data" * if inode had a delegation, 699 * Returns "true" and fills in "dst->data" * if inode had a delegation,
699 * otherwise zero is returned. 700 * otherwise "false" is returned.
700 */ 701 */
701int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode) 702bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode,
703 fmode_t flags)
702{ 704{
703 struct nfs_inode *nfsi = NFS_I(inode); 705 struct nfs_inode *nfsi = NFS_I(inode);
704 struct nfs_delegation *delegation; 706 struct nfs_delegation *delegation;
705 int ret = 0; 707 bool ret;
706 708
709 flags &= FMODE_READ|FMODE_WRITE;
707 rcu_read_lock(); 710 rcu_read_lock();
708 delegation = rcu_dereference(nfsi->delegation); 711 delegation = rcu_dereference(nfsi->delegation);
709 if (delegation != NULL) { 712 ret = (delegation != NULL && (delegation->type & flags) == flags);
713 if (ret) {
710 nfs4_stateid_copy(dst, &delegation->stateid); 714 nfs4_stateid_copy(dst, &delegation->stateid);
711 ret = 1; 715 nfs_mark_delegation_referenced(delegation);
712 } 716 }
713 rcu_read_unlock(); 717 rcu_read_unlock();
714 return ret; 718 return ret;