Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfsd: use new wake_up_var interfaces.

The wake_up_var interface is fragile as barriers are sometimes needed.
There are now new interfaces so that most wake-ups can use an interface
that is guaranteed to have all barriers needed.

This patch changes the wake up on cl_cb_inflight to use
atomic_dec_and_wake_up().

It also changes the wake up on rp_locked to use store_release_wake_up().
This involves changing rp_locked from atomic_t to int.

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

NeilBrown and committed by
Chuck Lever
935fee5d 19d97ac5

+8 -13
+1 -2
fs/nfsd/nfs4callback.c
··· 1036 1036 static void nfsd41_cb_inflight_end(struct nfs4_client *clp) 1037 1037 { 1038 1038 1039 - if (atomic_dec_and_test(&clp->cl_cb_inflight)) 1040 - wake_up_var(&clp->cl_cb_inflight); 1039 + atomic_dec_and_wake_up(&clp->cl_cb_inflight); 1041 1040 } 1042 1041 1043 1042 static void nfsd41_cb_inflight_wait_complete(struct nfs4_client *clp)
+6 -10
fs/nfsd/nfs4state.c
··· 4739 4739 rp->rp_status = nfserr_serverfault; 4740 4740 rp->rp_buflen = 0; 4741 4741 rp->rp_buf = rp->rp_ibuf; 4742 - atomic_set(&rp->rp_locked, RP_UNLOCKED); 4742 + rp->rp_locked = RP_UNLOCKED; 4743 4743 } 4744 4744 4745 4745 static int nfsd4_cstate_assign_replay(struct nfsd4_compound_state *cstate, ··· 4747 4747 { 4748 4748 if (!nfsd4_has_session(cstate)) { 4749 4749 wait_var_event(&so->so_replay.rp_locked, 4750 - atomic_cmpxchg(&so->so_replay.rp_locked, 4751 - RP_UNLOCKED, RP_LOCKED) != RP_LOCKED); 4752 - if (atomic_read(&so->so_replay.rp_locked) == RP_UNHASHED) 4750 + cmpxchg(&so->so_replay.rp_locked, 4751 + RP_UNLOCKED, RP_LOCKED) != RP_LOCKED); 4752 + if (so->so_replay.rp_locked == RP_UNHASHED) 4753 4753 return -EAGAIN; 4754 4754 cstate->replay_owner = nfs4_get_stateowner(so); 4755 4755 } ··· 4762 4762 4763 4763 if (so != NULL) { 4764 4764 cstate->replay_owner = NULL; 4765 - atomic_set(&so->so_replay.rp_locked, RP_UNLOCKED); 4766 - smp_mb__after_atomic(); 4767 - wake_up_var(&so->so_replay.rp_locked); 4765 + store_release_wake_up(&so->so_replay.rp_locked, RP_UNLOCKED); 4768 4766 nfs4_put_stateowner(so); 4769 4767 } 4770 4768 } ··· 5067 5069 * Some threads with a reference might be waiting for rp_locked, 5068 5070 * so tell them to stop waiting. 5069 5071 */ 5070 - atomic_set(&oo->oo_owner.so_replay.rp_locked, RP_UNHASHED); 5071 - smp_mb__after_atomic(); 5072 - wake_up_var(&oo->oo_owner.so_replay.rp_locked); 5072 + store_release_wake_up(&oo->oo_owner.so_replay.rp_locked, RP_UNHASHED); 5073 5073 wait_event(close_wq, refcount_read(&s->st_stid.sc_count) == 2); 5074 5074 5075 5075 release_all_access(s);
+1 -1
fs/nfsd/state.h
··· 505 505 unsigned int rp_buflen; 506 506 char *rp_buf; 507 507 struct knfsd_fh rp_openfh; 508 - atomic_t rp_locked; 508 + int rp_locked; 509 509 char rp_ibuf[NFSD4_REPLAY_ISIZE]; 510 510 }; 511 511