aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:39 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:39 -0500
commit15c831bf1a3f8cab9812a96228145200726fea33 (patch)
tree6133811e099f223d17aaa46c9672bfb367435b26
parent86e894899820f2b3094d5557124fc22743ae0fc7 (diff)
NFS: Use atomic bitops when changing struct nfs_delegation->flags
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/delegation.c6
-rw-r--r--fs/nfs/delegation.h4
-rw-r--r--fs/nfs/nfs4proc.c8
3 files changed, 9 insertions, 9 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 13f2044a30be..646ba3e75a1e 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -119,7 +119,7 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, st
119 delegation->maxsize = res->maxsize; 119 delegation->maxsize = res->maxsize;
120 oldcred = delegation->cred; 120 oldcred = delegation->cred;
121 delegation->cred = get_rpccred(cred); 121 delegation->cred = get_rpccred(cred);
122 delegation->flags &= ~NFS_DELEGATION_NEED_RECLAIM; 122 clear_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags);
123 NFS_I(inode)->delegation_state = delegation->type; 123 NFS_I(inode)->delegation_state = delegation->type;
124 smp_wmb(); 124 smp_wmb();
125 put_rpccred(oldcred); 125 put_rpccred(oldcred);
@@ -499,7 +499,7 @@ void nfs_delegation_mark_reclaim(struct nfs_client *clp)
499 struct nfs_delegation *delegation; 499 struct nfs_delegation *delegation;
500 rcu_read_lock(); 500 rcu_read_lock();
501 list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) 501 list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list)
502 delegation->flags |= NFS_DELEGATION_NEED_RECLAIM; 502 set_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags);
503 rcu_read_unlock(); 503 rcu_read_unlock();
504} 504}
505 505
@@ -513,7 +513,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
513restart: 513restart:
514 rcu_read_lock(); 514 rcu_read_lock();
515 list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) { 515 list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) {
516 if ((delegation->flags & NFS_DELEGATION_NEED_RECLAIM) == 0) 516 if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags) == 0)
517 continue; 517 continue;
518 inode = nfs_delegation_grab_inode(delegation); 518 inode = nfs_delegation_grab_inode(delegation);
519 if (inode == NULL) 519 if (inode == NULL)
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
index 8299c6220e95..5e9f40e0a7d8 100644
--- a/fs/nfs/delegation.h
+++ b/fs/nfs/delegation.h
@@ -18,10 +18,10 @@ struct nfs_delegation {
18 struct inode *inode; 18 struct inode *inode;
19 nfs4_stateid stateid; 19 nfs4_stateid stateid;
20 int type; 20 int type;
21#define NFS_DELEGATION_NEED_RECLAIM 1
22 long flags;
23 loff_t maxsize; 21 loff_t maxsize;
24 __u64 change_attr; 22 __u64 change_attr;
23#define NFS_DELEGATION_NEED_RECLAIM 0
24 unsigned long flags;
25 spinlock_t lock; 25 spinlock_t lock;
26 struct rcu_head rcu; 26 struct rcu_head rcu;
27}; 27};
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 254cbff103f5..d53aa2dace84 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -344,7 +344,7 @@ static int can_open_delegated(struct nfs_delegation *delegation, mode_t open_fla
344{ 344{
345 if ((delegation->type & open_flags) != open_flags) 345 if ((delegation->type & open_flags) != open_flags)
346 return 0; 346 return 0;
347 if (delegation->flags & NFS_DELEGATION_NEED_RECLAIM) 347 if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags))
348 return 0; 348 return 0;
349 return 1; 349 return 1;
350} 350}
@@ -536,7 +536,7 @@ static struct nfs4_state *nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data
536 if (delegation) 536 if (delegation)
537 delegation_flags = delegation->flags; 537 delegation_flags = delegation->flags;
538 rcu_read_unlock(); 538 rcu_read_unlock();
539 if (!(delegation_flags & NFS_DELEGATION_NEED_RECLAIM)) 539 if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0)
540 nfs_inode_set_delegation(state->inode, 540 nfs_inode_set_delegation(state->inode,
541 data->owner->so_cred, 541 data->owner->so_cred,
542 &data->o_res); 542 &data->o_res);
@@ -667,7 +667,7 @@ static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
667 opendata->o_arg.fh = NFS_FH(state->inode); 667 opendata->o_arg.fh = NFS_FH(state->inode);
668 rcu_read_lock(); 668 rcu_read_lock();
669 delegation = rcu_dereference(NFS_I(state->inode)->delegation); 669 delegation = rcu_dereference(NFS_I(state->inode)->delegation);
670 if (delegation != NULL && (delegation->flags & NFS_DELEGATION_NEED_RECLAIM) != 0) 670 if (delegation != NULL && test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags) != 0)
671 delegation_type = delegation->type; 671 delegation_type = delegation->type;
672 rcu_read_unlock(); 672 rcu_read_unlock();
673 opendata->o_arg.u.delegation_type = delegation_type; 673 opendata->o_arg.u.delegation_type = delegation_type;
@@ -839,7 +839,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
839 rcu_read_lock(); 839 rcu_read_lock();
840 delegation = rcu_dereference(NFS_I(data->state->inode)->delegation); 840 delegation = rcu_dereference(NFS_I(data->state->inode)->delegation);
841 if (delegation != NULL && 841 if (delegation != NULL &&
842 (delegation->flags & NFS_DELEGATION_NEED_RECLAIM) == 0) { 842 test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags) == 0) {
843 rcu_read_unlock(); 843 rcu_read_unlock();
844 goto out_no_action; 844 goto out_no_action;
845 } 845 }