NFSv4.1 free slot before resending I/O to MDS

Fix a dynamic session slot leak where a slot is preallocated and I/O is
resent through the MDS.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>

authored by Andy Adamson and committed by Trond Myklebust f9c96fcc 4db72b40

+11 -3
+1
fs/nfs/nfs4_fs.h
··· 270 270 extern int nfs41_setup_sequence(struct nfs4_session *session, 271 271 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 272 272 struct rpc_task *task); 273 + extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *); 273 274 extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *); 274 275 extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *); 275 276 extern int nfs4_proc_get_lease_time(struct nfs_client *clp,
+8 -2
fs/nfs/nfs4filelayout.c
··· 335 335 dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status); 336 336 337 337 if (test_bit(NFS_IOHDR_REDO, &rdata->header->flags) && 338 - task->tk_status == 0) 338 + task->tk_status == 0) { 339 + if (rdata->res.seq_res.sr_slot != NULL) 340 + nfs41_sequence_done(task, &rdata->res.seq_res); 339 341 return; 342 + } 340 343 341 344 /* Note this may cause RPC to be resent */ 342 345 rdata->header->mds_ops->rpc_call_done(task, data); ··· 445 442 struct nfs_write_data *wdata = data; 446 443 447 444 if (test_bit(NFS_IOHDR_REDO, &wdata->header->flags) && 448 - task->tk_status == 0) 445 + task->tk_status == 0) { 446 + if (wdata->res.seq_res.sr_slot != NULL) 447 + nfs41_sequence_done(task, &wdata->res.seq_res); 449 448 return; 449 + } 450 450 451 451 /* Note this may cause RPC to be resent */ 452 452 wdata->header->mds_ops->rpc_call_done(task, data);
+2 -1
fs/nfs/nfs4proc.c
··· 592 592 nfs41_server_notify_highest_slotid_update(session->clp); 593 593 } 594 594 595 - static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) 595 + int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) 596 596 { 597 597 struct nfs4_session *session; 598 598 struct nfs4_slot *slot; ··· 692 692 rpc_delay(task, NFS4_POLL_RETRY_MAX); 693 693 return 0; 694 694 } 695 + EXPORT_SYMBOL_GPL(nfs41_sequence_done); 695 696 696 697 static int nfs4_sequence_done(struct rpc_task *task, 697 698 struct nfs4_sequence_res *res)