public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] NFSv4.1 free slot before resending I/O to MDS
@ 2014-01-28 23:01 andros
  2014-01-28 23:01 ` [PATCH 1/1] " andros
  0 siblings, 1 reply; 3+ messages in thread
From: andros @ 2014-01-28 23:01 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs, Andy Adamson

From: Andy Adamson <andros@netapp.com>

Replaces NFSv4.1 Do not pre-allocate slots in nfs4_end_drain_slot_tbl.

Andy Adamson (1):
  NFSv4.1 free slot before resending I/O to MDS

 fs/nfs/nfs4filelayout.c | 6 ++++++
 fs/nfs/nfs4session.c    | 1 +
 2 files changed, 7 insertions(+)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] NFSv4.1 free slot before resending I/O to MDS
  2014-01-28 23:01 [PATCH 0/1] NFSv4.1 free slot before resending I/O to MDS andros
@ 2014-01-28 23:01 ` andros
  2014-01-28 23:28   ` Trond Myklebust
  0 siblings, 1 reply; 3+ messages in thread
From: andros @ 2014-01-28 23:01 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs, Andy Adamson

From: Andy Adamson <andros@netapp.com>

Free an allocated slot from nfs41_wake_and_assign_slot prior to rpc_exit.
Prevents a state_manager hang when draining a data server session.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/nfs4filelayout.c | 6 ++++++
 fs/nfs/nfs4session.c    | 1 +
 2 files changed, 7 insertions(+)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 03fd8be..9611999 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -314,6 +314,9 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
 	if (filelayout_reset_to_mds(rdata->header->lseg)) {
 		dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
 		filelayout_reset_read(rdata);
+		if (rdata->res.seq_res.sr_slot != NULL)
+			nfs4_free_slot(&rdata->ds_clp->cl_session->fc_slot_table,
+					rdata->res.seq_res.sr_slot);
 		rpc_exit(task, 0);
 		return;
 	}
@@ -425,6 +428,9 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
 	if (filelayout_reset_to_mds(wdata->header->lseg)) {
 		dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
 		filelayout_reset_write(wdata);
+		if (wdata->res.seq_res.sr_slot != NULL)
+			nfs4_free_slot(&wdata->ds_clp->cl_session->fc_slot_table,
+					wdata->res.seq_res.sr_slot);
 		rpc_exit(task, 0);
 		return;
 	}
diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index cf883c7..5226846 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -98,6 +98,7 @@ void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot)
 	dprintk("%s: slotid %u highest_used_slotid %u\n", __func__,
 		slotid, tbl->highest_used_slotid);
 }
+EXPORT_SYMBOL_GPL(nfs4_free_slot);
 
 static struct nfs4_slot *nfs4_new_slot(struct nfs4_slot_table  *tbl,
 		u32 slotid, u32 seq_init, gfp_t gfp_mask)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] NFSv4.1 free slot before resending I/O to MDS
  2014-01-28 23:01 ` [PATCH 1/1] " andros
@ 2014-01-28 23:28   ` Trond Myklebust
  0 siblings, 0 replies; 3+ messages in thread
From: Trond Myklebust @ 2014-01-28 23:28 UTC (permalink / raw)
  To: Adamson William Andros; +Cc: linuxnfs

Hi Andy,

On Jan 28, 2014, at 18:01, <andros@netapp.com> <andros@netapp.com> wrote:

> From: Andy Adamson <andros@netapp.com>
> 
> Free an allocated slot from nfs41_wake_and_assign_slot prior to rpc_exit.
> Prevents a state_manager hang when draining a data server session.
> 
> Signed-off-by: Andy Adamson <andros@netapp.com>
> ---
> fs/nfs/nfs4filelayout.c | 6 ++++++
> fs/nfs/nfs4session.c    | 1 +
> 2 files changed, 7 insertions(+)
> 
> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> index 03fd8be..9611999 100644
> --- a/fs/nfs/nfs4filelayout.c
> +++ b/fs/nfs/nfs4filelayout.c
> @@ -314,6 +314,9 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
> 	if (filelayout_reset_to_mds(rdata->header->lseg)) {
> 		dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
> 		filelayout_reset_read(rdata);
> +		if (rdata->res.seq_res.sr_slot != NULL)
> +			nfs4_free_slot(&rdata->ds_clp->cl_session->fc_slot_table,
> +					rdata->res.seq_res.sr_slot);
> 		rpc_exit(task, 0);
> 		return;
> 	}
> @@ -425,6 +428,9 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
> 	if (filelayout_reset_to_mds(wdata->header->lseg)) {
> 		dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
> 		filelayout_reset_write(wdata);
> +		if (wdata->res.seq_res.sr_slot != NULL)
> +			nfs4_free_slot(&wdata->ds_clp->cl_session->fc_slot_table,
> +					wdata->res.seq_res.sr_slot);
> 		rpc_exit(task, 0);
> 		return;
> 	}
> diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
> index cf883c7..5226846 100644
> --- a/fs/nfs/nfs4session.c
> +++ b/fs/nfs/nfs4session.c
> @@ -98,6 +98,7 @@ void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot)
> 	dprintk("%s: slotid %u highest_used_slotid %u\n", __func__,
> 		slotid, tbl->highest_used_slotid);
> }
> +EXPORT_SYMBOL_GPL(nfs4_free_slot);
> 
> static struct nfs4_slot *nfs4_new_slot(struct nfs4_slot_table  *tbl,
> 		u32 slotid, u32 seq_init, gfp_t gfp_mask)

OK, this fix makes a lot more sense to me.

However, since rpc_exit() will trigger a call to the rpc_call_ops->rpc_call_done(), then perhaps a better alternative would be to have filelayout_read_call_done() and filelayout_write_call_done() call nfs41_sequence_done() if the test for NFS_IOHDR_REDO succeeds? Otherwise, it looks as if we still have the potential for a leak.

--
Trond Myklebust
Linux NFS client maintainer


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-28 23:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28 23:01 [PATCH 0/1] NFSv4.1 free slot before resending I/O to MDS andros
2014-01-28 23:01 ` [PATCH 1/1] " andros
2014-01-28 23:28   ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox