summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-17 22:57:37 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 19:28:08 -0500
commit961a828df64979d2a9faeeeee043391670a193b9 (patch)
tree4b7ddaf1a19c589e3c8ec96b6c732faa507f2899 /fs/nfs/nfs4proc.c
parent2aeb98f498ce37742b743080fdc6c8cf64053599 (diff)
SUNRPC: Fix potential races in xprt_lock_write_next()
We have to ensure that the wake up from the waitqueue and the assignment of xprt->snd_task are atomic. We can do this by assigning the snd_task while under the waitqueue spinlock. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 360240cc1e9b..828a76590af9 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -385,17 +385,20 @@ nfs4_free_slot(struct nfs4_slot_table *tbl, u8 free_slotid)
385 free_slotid, tbl->highest_used_slotid); 385 free_slotid, tbl->highest_used_slotid);
386} 386}
387 387
388bool nfs4_set_task_privileged(struct rpc_task *task, void *dummy)
389{
390 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
391 return true;
392}
393
388/* 394/*
389 * Signal state manager thread if session fore channel is drained 395 * Signal state manager thread if session fore channel is drained
390 */ 396 */
391static void nfs4_check_drain_fc_complete(struct nfs4_session *ses) 397static void nfs4_check_drain_fc_complete(struct nfs4_session *ses)
392{ 398{
393 struct rpc_task *task;
394
395 if (!test_bit(NFS4_SESSION_DRAINING, &ses->session_state)) { 399 if (!test_bit(NFS4_SESSION_DRAINING, &ses->session_state)) {
396 task = rpc_wake_up_next(&ses->fc_slot_table.slot_tbl_waitq); 400 rpc_wake_up_first(&ses->fc_slot_table.slot_tbl_waitq,
397 if (task) 401 nfs4_set_task_privileged, NULL);
398 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
399 return; 402 return;
400 } 403 }
401 404