aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-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);