aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/callback_proc.c
diff options
context:
space:
mode:
authorMike Sager <sager@netapp.com>2010-01-19 12:54:40 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-02-10 08:30:55 -0500
commita7989c3e4702203baa5ddb3614f92bfc49a6e491 (patch)
tree44c17934e8a3165f129922bd6f4732beee3cd527 /fs/nfs/callback_proc.c
parent8e0d46e13833b06832395e7eacccae8af8743461 (diff)
nfs41: Check slot table for referring calls
Traverse a list of referring calls and look for a session/slot/seq number match. Signed-off-by: Mike Sager <sager@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/callback_proc.c')
-rw-r--r--fs/nfs/callback_proc.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index defa9b4c470e..631b44c1439b 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -225,6 +225,61 @@ validate_seqid(struct nfs4_slot_table *tbl, u32 slotid, u32 seqid)
225 return NULL; 225 return NULL;
226} 226}
227 227
228/*
229 * For each referring call triple, check the session's slot table for
230 * a match. If the slot is in use and the sequence numbers match, the
231 * client is still waiting for a response to the original request.
232 */
233static bool referring_call_exists(struct nfs_client *clp,
234 uint32_t nrclists,
235 struct referring_call_list *rclists)
236{
237 bool status = 0;
238 int i, j;
239 struct nfs4_session *session;
240 struct nfs4_slot_table *tbl;
241 struct referring_call_list *rclist;
242 struct referring_call *ref;
243
244 /*
245 * XXX When client trunking is implemented, this becomes
246 * a session lookup from within the loop
247 */
248 session = clp->cl_session;
249 tbl = &session->fc_slot_table;
250
251 for (i = 0; i < nrclists; i++) {
252 rclist = &rclists[i];
253 if (memcmp(session->sess_id.data,
254 rclist->rcl_sessionid.data,
255 NFS4_MAX_SESSIONID_LEN) != 0)
256 continue;
257
258 for (j = 0; j < rclist->rcl_nrefcalls; j++) {
259 ref = &rclist->rcl_refcalls[j];
260
261 dprintk("%s: sessionid %x:%x:%x:%x sequenceid %u "
262 "slotid %u\n", __func__,
263 ((u32 *)&rclist->rcl_sessionid.data)[0],
264 ((u32 *)&rclist->rcl_sessionid.data)[1],
265 ((u32 *)&rclist->rcl_sessionid.data)[2],
266 ((u32 *)&rclist->rcl_sessionid.data)[3],
267 ref->rc_sequenceid, ref->rc_slotid);
268
269 spin_lock(&tbl->slot_tbl_lock);
270 status = (test_bit(ref->rc_slotid, tbl->used_slots) &&
271 tbl->slots[ref->rc_slotid].seq_nr ==
272 ref->rc_sequenceid);
273 spin_unlock(&tbl->slot_tbl_lock);
274 if (status)
275 goto out;
276 }
277 }
278
279out:
280 return status;
281}
282
228/* FIXME: referring calls should be processed */ 283/* FIXME: referring calls should be processed */
229unsigned nfs4_callback_sequence(struct cb_sequenceargs *args, 284unsigned nfs4_callback_sequence(struct cb_sequenceargs *args,
230 struct cb_sequenceres *res) 285 struct cb_sequenceres *res)