aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-04-01 09:22:18 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 13:46:41 -0400
commitb0df806c0f9d61e5fcfdb0f4e606e1a59303aaa6 (patch)
tree483e911bff62662ed4cce2c003a96a52d223c942 /fs
parent13615871cdf8e8263626a817c350c6978a6483fe (diff)
nfs41: nfs41_sequence_done
Handle session level errors, update slot sequence id and sessions bookeeping, free slot. [nfs41: sequence res use slotid] Signed-off-by: Andy Adamson<andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: remove SEQ4_STATUS_USE_TK_STATUS] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: check for session not minorversion] Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: bail out early out of nfs41_sequence_done if !res->sr_session] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [move nfs4_sequence_done from nfs41: nfs41_call_sync_done] Signed-off-by: Andy Adamson <andros@netapp.com> [move nfs4_sequence_free_slot from nfs41: separate free slot from sequence done] Don't free the slot until after all rpc_restart_calls have completed. Session reset will require more work. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [moved reset sr_slotid to nfs41_sequence_free_slot] [free slot also on unexpectecd error] [remove seq_res.sr_session member, use nfs_client's instead] [ditch seq_res.sr_flags until used] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [look at sr_slotid for bailing out early from nfs41_sequence_done] [nfs41: rpc_wake_up_next if sessions slot was not consumed.] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: nfs4_sequence_free_slot use nfs_client for data server] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: remove unused error checking in nfs41_sequence_done] Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: remove nfs4_has_session check in nfs41_sequence_done] Signed-off-by: Andy Adamson <andros@netapp.com> [nfs41: remove nfs_client pointer check] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 861b103c9e3c..188f2ce593ec 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -330,6 +330,46 @@ void nfs41_sequence_free_slot(const struct nfs_client *clp,
330 res->sr_slotid = NFS4_MAX_SLOT_TABLE; 330 res->sr_slotid = NFS4_MAX_SLOT_TABLE;
331} 331}
332 332
333static void nfs41_sequence_done(struct nfs_client *clp,
334 struct nfs4_sequence_res *res,
335 int rpc_status)
336{
337 unsigned long timestamp;
338 struct nfs4_slot_table *tbl;
339 struct nfs4_slot *slot;
340
341 /*
342 * sr_status remains 1 if an RPC level error occurred. The server
343 * may or may not have processed the sequence operation..
344 * Proceed as if the server received and processed the sequence
345 * operation.
346 */
347 if (res->sr_status == 1)
348 res->sr_status = NFS_OK;
349
350 /* -ERESTARTSYS can result in skipping nfs41_sequence_setup */
351 if (res->sr_slotid == NFS4_MAX_SLOT_TABLE)
352 goto out;
353
354 tbl = &clp->cl_session->fc_slot_table;
355 slot = tbl->slots + res->sr_slotid;
356
357 if (res->sr_status == 0) {
358 /* Update the slot's sequence and clientid lease timer */
359 ++slot->seq_nr;
360 timestamp = res->sr_renewal_time;
361 spin_lock(&clp->cl_lock);
362 if (time_before(clp->cl_last_renewal, timestamp))
363 clp->cl_last_renewal = timestamp;
364 spin_unlock(&clp->cl_lock);
365 return;
366 }
367out:
368 /* The session may be reset by one of the error handlers. */
369 dprintk("%s: Error %d free the slot \n", __func__, res->sr_status);
370 nfs41_sequence_free_slot(clp, res);
371}
372
333/* 373/*
334 * nfs4_find_slot - efficiently look for a free slot 374 * nfs4_find_slot - efficiently look for a free slot
335 * 375 *
@@ -515,6 +555,24 @@ int _nfs4_call_sync(struct nfs_server *server,
515 (server)->nfs_client->cl_call_sync((server), (msg), &(args)->seq_args, \ 555 (server)->nfs_client->cl_call_sync((server), (msg), &(args)->seq_args, \
516 &(res)->seq_res, (cache_reply)) 556 &(res)->seq_res, (cache_reply))
517 557
558static void nfs4_sequence_done(const struct nfs_server *server,
559 struct nfs4_sequence_res *res, int rpc_status)
560{
561#ifdef CONFIG_NFS_V4_1
562 if (nfs4_has_session(server->nfs_client))
563 nfs41_sequence_done(server->nfs_client, res, rpc_status);
564#endif /* CONFIG_NFS_V4_1 */
565}
566
567/* no restart, therefore free slot here */
568static void nfs4_sequence_done_free_slot(const struct nfs_server *server,
569 struct nfs4_sequence_res *res,
570 int rpc_status)
571{
572 nfs4_sequence_done(server, res, rpc_status);
573 nfs4_sequence_free_slot(server->nfs_client, res);
574}
575
518static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 576static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
519{ 577{
520 struct nfs_inode *nfsi = NFS_I(dir); 578 struct nfs_inode *nfsi = NFS_I(dir);