linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request
@ 2019-03-01 19:11 Trond Myklebust
  2019-03-01 19:11 ` [PATCH 2/2] NFSv4.1: Don't process the sequence op more than once Trond Myklebust
  2019-03-05 13:35 ` [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request Sasha Levin
  0 siblings, 2 replies; 3+ messages in thread
From: Trond Myklebust @ 2019-03-01 19:11 UTC (permalink / raw)
  To: linux-nfs

If we have to retransmit a request, we should ensure that we reinitialise
the sequence results structure, since in the event of a signal
we need to treat the request as if it had not been sent.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org
---
 fs/nfs/nfs4proc.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 77c6e2d3f3fc..5f8517d1a0a5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -945,6 +945,13 @@ EXPORT_SYMBOL_GPL(nfs4_sequence_done);
 
 #endif	/* !CONFIG_NFS_V4_1 */
 
+static void nfs41_sequence_res_init(struct nfs4_sequence_res *res)
+{
+	res->sr_timestamp = jiffies;
+	res->sr_status_flags = 0;
+	res->sr_status = 1;
+}
+
 static
 void nfs4_sequence_attach_slot(struct nfs4_sequence_args *args,
 		struct nfs4_sequence_res *res,
@@ -956,10 +963,6 @@ void nfs4_sequence_attach_slot(struct nfs4_sequence_args *args,
 	args->sa_slot = slot;
 
 	res->sr_slot = slot;
-	res->sr_timestamp = jiffies;
-	res->sr_status_flags = 0;
-	res->sr_status = 1;
-
 }
 
 int nfs4_setup_sequence(struct nfs_client *client,
@@ -998,6 +1001,7 @@ int nfs4_setup_sequence(struct nfs_client *client,
 
 	trace_nfs4_setup_sequence(session, args);
 out_start:
+	nfs41_sequence_res_init(res);
 	rpc_call_start(task);
 	return 0;
 
-- 
2.20.1


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

* [PATCH 2/2] NFSv4.1: Don't process the sequence op more than once.
  2019-03-01 19:11 [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request Trond Myklebust
@ 2019-03-01 19:11 ` Trond Myklebust
  2019-03-05 13:35 ` [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Trond Myklebust @ 2019-03-01 19:11 UTC (permalink / raw)
  To: linux-nfs

Ensure that if we call nfs41_sequence_process() a second time for the
same rpc_task, then we only process the results once.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5f8517d1a0a5..5b980246b035 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -754,7 +754,7 @@ static int nfs41_sequence_process(struct rpc_task *task,
 	if (slot == NULL)
 		goto out_noaction;
 	/* don't increment the sequence number if the task wasn't sent */
-	if (!RPC_WAS_SENT(task))
+	if (!RPC_WAS_SENT(task) || slot->seq_done)
 		goto out;
 
 	session = slot->table->session;
-- 
2.20.1


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

* Re: [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request
  2019-03-01 19:11 [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request Trond Myklebust
  2019-03-01 19:11 ` [PATCH 2/2] NFSv4.1: Don't process the sequence op more than once Trond Myklebust
@ 2019-03-05 13:35 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2019-03-05 13:35 UTC (permalink / raw)
  To: Sasha Levin, Trond Myklebust, linux-nfs; +Cc: stable, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v4.20.13, v4.19.26, v4.14.104, v4.9.161, v4.4.176, v3.18.136.

v4.20.13: Build OK!
v4.19.26: Build OK!
v4.14.104: Build OK!
v4.9.161: Failed to apply! Possible dependencies:
    172d9de15a0d ("NFS: Change nfs4_get_session() to take an nfs_client structure")
    3be0f80b5fe9 ("NFSv4.1: Fix up replays of interrupted requests")
    42e1cca7e91e ("NFS: Change nfs4_setup_sequence() to take an nfs_client structure")
    6de7e12f53a1 ("NFS: Use nfs4_setup_sequence() everywhere")
    7981c8a65914 ("NFS: Create a single nfs4_setup_sequence() function")
    efc6f4aa742d ("NFS: Move nfs4_get_session() into nfs4_session.h")

v4.4.176: Failed to apply! Possible dependencies:
    172d9de15a0d ("NFS: Change nfs4_get_session() to take an nfs_client structure")
    3be0f80b5fe9 ("NFSv4.1: Fix up replays of interrupted requests")
    42e1cca7e91e ("NFS: Change nfs4_setup_sequence() to take an nfs_client structure")
    5f83d86cf531 ("NFSv4.x: Fix wraparound issues when validing the callback sequence id")
    68d264cf02b0 ("NFS42: handle layoutstats stateid error")
    6de7e12f53a1 ("NFS: Use nfs4_setup_sequence() everywhere")
    80f9642724af ("NFSv4.x: Enforce the ca_maxresponsesize_cached on the back channel")
    810d82e68301 ("NFSv4.x: Allow multiple callbacks in flight")
    9a0fe86745b8 ("pNFS: Handle NFS4ERR_OLD_STATEID correctly in LAYOUTSTAT calls")
    efc6f4aa742d ("NFS: Move nfs4_get_session() into nfs4_session.h")
    f74a834a0e1b ("NFSv4.x: CB_SEQUENCE should return NFS4ERR_DELAY if still executing")

v3.18.136: Failed to apply! Possible dependencies:
    193e3aa2ccfb ("nfs41: introduce NFS_LAYOUT_RETURN_BEFORE_CLOSE")
    3be0f80b5fe9 ("NFSv4.1: Fix up replays of interrupted requests")
    4579d6b897ee ("nfs41: pass iomode through layoutreturn args")
    6de7e12f53a1 ("NFS: Use nfs4_setup_sequence() everywhere")
    9bf87482ddc6 ("nfs41: serialize first layoutget of a file")
    aa8a45ee974d ("nfs41: wait for LAYOUTRETURN before retrying LAYOUTGET")
    abcb7bfc9fde ("pNFS/flexfiles: add layoutstats tracking")
    c829013dca33 ("nfs41: add NFS_LAYOUT_RETRY_LAYOUTGET to layout header flags")
    ce6ab4f238cb ("nfs41: don't use a layout if it is marked for returning")
    d67ae825a59d ("pnfs/flexfiles: Add the FlexFile Layout Driver")
    e736a5b98c7a ("nfs41: clear NFS_LAYOUT_RETURN if layoutreturn is sent or failed to send")
    f40eb5d044e2 ("nfs41: make a helper function to send layoutreturn")


How should we proceed with this patch?

--
Thanks,
Sasha

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

end of thread, other threads:[~2019-03-05 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01 19:11 [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request Trond Myklebust
2019-03-01 19:11 ` [PATCH 2/2] NFSv4.1: Don't process the sequence op more than once Trond Myklebust
2019-03-05 13:35 ` [PATCH 1/2] NFSv4.1: Reinitialise sequence results before retransmitting a request Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).