Skip to content

Commit f9c96fc

Browse files
androsadamsontrondmypd
authored andcommitted
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>
1 parent 4db72b4 commit f9c96fc

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

fs/nfs/nfs4_fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *ser
270270
extern int nfs41_setup_sequence(struct nfs4_session *session,
271271
struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
272272
struct rpc_task *task);
273+
extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
273274
extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *);
274275
extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *);
275276
extern int nfs4_proc_get_lease_time(struct nfs_client *clp,

fs/nfs/nfs4filelayout.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,11 @@ static void filelayout_read_call_done(struct rpc_task *task, void *data)
335335
dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status);
336336

337337
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);
339341
return;
342+
}
340343

341344
/* Note this may cause RPC to be resent */
342345
rdata->header->mds_ops->rpc_call_done(task, data);
@@ -442,8 +445,11 @@ static void filelayout_write_call_done(struct rpc_task *task, void *data)
442445
struct nfs_write_data *wdata = data;
443446

444447
if (test_bit(NFS_IOHDR_REDO, &wdata->header->flags) &&
445-
task->tk_status == 0)
448+
task->tk_status == 0) {
449+
if (wdata->res.seq_res.sr_slot != NULL)
450+
nfs41_sequence_done(task, &wdata->res.seq_res);
446451
return;
452+
}
447453

448454
/* Note this may cause RPC to be resent */
449455
wdata->header->mds_ops->rpc_call_done(task, data);

fs/nfs/nfs4proc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
592592
nfs41_server_notify_highest_slotid_update(session->clp);
593593
}
594594

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)
596596
{
597597
struct nfs4_session *session;
598598
struct nfs4_slot *slot;
@@ -692,6 +692,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
692692
rpc_delay(task, NFS4_POLL_RETRY_MAX);
693693
return 0;
694694
}
695+
EXPORT_SYMBOL_GPL(nfs41_sequence_done);
695696

696697
static int nfs4_sequence_done(struct rpc_task *task,
697698
struct nfs4_sequence_res *res)

0 commit comments

Comments
 (0)