All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Args need to be the same for replay cache
@ 2017-10-11 16:48 Thomas Haynes
  2017-10-12 18:32 ` pynfs replay cache test SEQ9f Thomas Haynes
  2018-04-10 19:49 ` [PATCH] Args need to be the same for replay cache J. Bruce Fields
  0 siblings, 2 replies; 18+ messages in thread
From: Thomas Haynes @ 2017-10-11 16:48 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Mailing List Linux NFS

From: Tom Haynes <loghyr@primarydata.com>

2.10.6.1.3.1.  False Retry

  If a requester sent a Sequence operation with a slot ID and sequence
  ID that are in the reply cache but the replier detected that the
  retried request is not the same as the original request, including a
  retry that has different operations or different arguments in the
  operations from the original and a retry that uses a different
   principal in the RPC request's credential field that translates to a
  different user, then this is a false retry.  When the replier detects
  a false retry, it is permitted (but not always obligated) to return
  NFS4ERR_SEQ_FALSE_RETRY in response to the Sequence operation when it
  detects a false retry.

Or in other words, sa_cachethis needs to be set or a
server can respond with an error.

Signed-off-by: Tom Haynes <loghyr@primarydata.com>
---
 nfs4.1/server41tests/st_sequence.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/nfs4.1/server41tests/st_sequence.py b/nfs4.1/server41tests/st_=
sequence.py
index d8d460c..e1e5f06 100644
--- a/nfs4.1/server41tests/st_sequence.py
+++ b/nfs4.1/server41tests/st_sequence.py
@@ -115,7 +115,7 @@ def testReplayCache001(t, env):
     sess1 =3D c1.create_session()
     res1 =3D sess1.compound([op.putrootfh()], cache_this=3DTrue)
     check(res1)
-    res2 =3D sess1.compound([op.putrootfh()], seq_delta=3D0)
+    res2 =3D sess1.compound([op.putrootfh()], cache_this=3DTrue, seq_delta=
=3D0)
     check(res2)
     res1.tag =3D res2.tag =3D ""
     if not nfs4lib.test_equal(res1, res2):
@@ -137,7 +137,7 @@ def testReplayCache002(t, env):
           op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
     res1 =3D sess1.compound(ops, cache_this=3DTrue)
     check(res1)
-    res2 =3D sess1.compound(ops, seq_delta=3D0)
+    res2 =3D sess1.compound(ops, cache_this=3DTrue, seq_delta=3D0)
     check(res2)
     res1.tag =3D res2.tag =3D ""
     if not nfs4lib.test_equal(res1, res2):
@@ -158,7 +158,7 @@ def testReplayCache003(t, env):
     sess1 =3D c1.create_session()
     res1 =3D sess1.compound([op.putrootfh(), op.lookup("")], cache_this=3D=
True)
     check(res1, NFS4ERR_INVAL)
-    res2 =3D sess1.compound([op.putrootfh(), op.lookup("")], seq_delta=3D0=
)
+    res2 =3D sess1.compound([op.putrootfh(), op.lookup("")], cache_this=3D=
True, seq_delta=3D0)
     check(res2, NFS4ERR_INVAL)
     res1.tag =3D res2.tag =3D ""
     if not nfs4lib.test_equal(res1, res2):
@@ -176,7 +176,7 @@ def testReplayCache004(t, env):
     ops +=3D [op.savefh(), op.rename("", "foo")]
     res1 =3D sess1.compound(ops, cache_this=3DTrue)
     check(res1, NFS4ERR_INVAL)
-    res2 =3D sess1.compound(ops, seq_delta=3D0)
+    res2 =3D sess1.compound(ops, cache_this=3DTrue, seq_delta=3D0)
     check(res2, NFS4ERR_INVAL)
     res1.tag =3D res2.tag =3D ""
     if not nfs4lib.test_equal(res1, res2):
@@ -192,7 +192,7 @@ def testReplayCache005(t, env):
     sess1 =3D c1.create_session()
     res1 =3D sess1.compound([op.illegal()], cache_this=3DTrue)
     check(res1, NFS4ERR_OP_ILLEGAL)
-    res2 =3D sess1.compound([op.illegal()], seq_delta=3D0)
+    res2 =3D sess1.compound([op.illegal()], cache_this=3DTrue, seq_delta=
=3D0)
     check(res2, NFS4ERR_OP_ILLEGAL)
     res1.tag =3D res2.tag =3D ""
     if not nfs4lib.test_equal(res1, res2):
@@ -208,7 +208,7 @@ def testReplayCache006(t, env):
     sess =3D c.create_session()
     res1 =3D sess.compound([])
     check(res1)
-    res2 =3D sess.compound([], seq_delta=3D0)
+    res2 =3D sess.compound([], cache_this=3DTrue, seq_delta=3D0)
     check(res2)
     res1.tag =3D res2.tag =3D ""
     if not nfs4lib.test_equal(res1, res2):
--=20
2.3.6


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

* pynfs replay cache test SEQ9f
  2017-10-11 16:48 [PATCH] Args need to be the same for replay cache Thomas Haynes
@ 2017-10-12 18:32 ` Thomas Haynes
  2017-10-12 19:30   ` Trond Myklebust
  2017-10-12 19:49   ` J. Bruce Fields
  2018-04-10 19:49 ` [PATCH] Args need to be the same for replay cache J. Bruce Fields
  1 sibling, 2 replies; 18+ messages in thread
From: Thomas Haynes @ 2017-10-12 18:32 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Mailing List Linux NFS, nfsv4

Hi Bruce,

In this test:

def testReplayCache006(t, env):
   """Send two solo sequence compounds with same seqid

   FLAGS: sequence all
   CODE: SEQ9f
   """
   c =3D env.c1.new_client(env.testname(t))
   sess =3D c.create_session()
   res1 =3D sess.compound([])
   check(res1)
   res2 =3D sess.compound([], cache_this=3DTrue, seq_delta=3D0)
   check(res2)
   res1.tag =3D res2.tag =3D ""
   if not nfs4lib.test_equal(res1, res2):
       fail("Replay results not equal")

I don't see why the result should be NFS4_OK.

The first compound does not set sa_cachethis and the second
does set it. According to RFC5661, the server is not required
to cache the first request if the client does not request it.

And if the server does not cache the response, when it gets
a request to replay it, it can return NFS4ERR_RETRY_UNCACHED_REP:

2.10.6.1.3.  Optional Reply Caching

  On a per-request basis, the requester can choose to direct the
  replier to cache the reply to all operations after the first
  operation (SEQUENCE or CB_SEQUENCE) via the sa_cachethis or
  csa_cachethis fields of the arguments to SEQUENCE or CB_SEQUENCE.
  The reason it would not direct the replier to cache the entire reply
  is that the request is composed of all idempotent operations [34].
  Caching the reply may offer little benefit.  If the reply is too
  large (see Section 2.10.6.4), it may not be cacheable anyway.  Even
  if the reply to idempotent request is small enough to cache,
  unnecessarily caching the reply slows down the server and increases
  RPC latency.

  Whether or not the requester requests the reply to be cached has no
  effect on the slot processing.  If the results of SEQUENCE or
  CB_SEQUENCE are NFS4_OK, then the slot's sequence ID MUST be
  incremented by one.  If a requester does not direct the replier to
  cache the reply, the replier MUST do one of following:

  o  The replier can cache the entire original reply.  Even though
     sa_cachethis or csa_cachethis is FALSE, the replier is always free
     to cache.  It may choose this approach in order to simplify
     implementation.

  o  The replier enters into its reply cache a reply consisting of the
     original results to the SEQUENCE or CB_SEQUENCE operation, and
     with the next operation in COMPOUND or CB_COMPOUND having the
     error NFS4ERR_RETRY_UNCACHED_REP.  Thus, if the requester later
     retries the request, it will get NFS4ERR_RETRY_UNCACHED_REP.  If a
     replier receives a retried Sequence operation where the reply to
     the COMPOUND or CB_COMPOUND was not cached, then the replier,

Further, since the parameters to SEQUENCE are different it is a false
retry according to this:

2.10.6.1.3.1.  False Retry

If a requester sent a Sequence operation with a slot ID and sequence
ID that are in the reply cache but the replier detected that the
retried request is not the same as the original request, including a
retry that has different operations or different arguments in the
operations from the original and a retry that uses a different
 principal in the RPC request's credential field that translates to a
different user, then this is a false retry.  When the replier detects
a false retry, it is permitted (but not always obligated) to return
NFS4ERR_SEQ_FALSE_RETRY in response to the Sequence operation when it
detects a false retry.

I'm not sure if the test should be fixed to either

1) allow either NFS4_OK or NFS4ERR_RETRY_UNCACHED_REP
2) just remove the test.

Thoughts?


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

* Re: pynfs replay cache test SEQ9f
  2017-10-12 18:32 ` pynfs replay cache test SEQ9f Thomas Haynes
@ 2017-10-12 19:30   ` Trond Myklebust
  2017-10-12 19:49   ` J. Bruce Fields
  1 sibling, 0 replies; 18+ messages in thread
From: Trond Myklebust @ 2017-10-12 19:30 UTC (permalink / raw)
  To: bfields, Thomas Haynes; +Cc: linux-nfs, nfsv4

T24gVGh1LCAyMDE3LTEwLTEyIGF0IDE4OjMyICswMDAwLCBUaG9tYXMgSGF5bmVzIHdyb3RlOg0K
PiBIaSBCcnVjZSwNCj4gDQo+IEluIHRoaXMgdGVzdDoNCj4gDQo+IGRlZiB0ZXN0UmVwbGF5Q2Fj
aGUwMDY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bmNlIGluIGEgY29tcG91bmQgYWx3
YXlzIGhhcyB0bw0KcmV0dXJuIGVpdGhlciBORlNfT0ssIG9yIHBvc3NpYmx5IE5GUzRFUlJfU0VR
X0ZBTFNFX1JFVFJZLiBUaGUgbGF0dGVyDQpzaG91bGQgcHJlc3VtYWJseSBiZSBhbGxvd2VkLCBz
aW5jZSB0aGVyZSBpcyBubyBleGNlcHRpb24gY2FydmVkIG91dCBpbg0KMi4xMC42LjEuMy4xIGZv
ciB0aGUgc2VxdWVuY2Ugb3Agdy5yLnQuIGJlaGF2aW91ciB3aXRoIGRpZmZlcmVudA0Kb3BlcmF0
aW9uIGFyZ3VtZW50cy4NCg0KLS0gDQpUcm9uZCBNeWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQg
bWFpbnRhaW5lciwgUHJpbWFyeURhdGENCnRyb25kLm15a2xlYnVzdEBwcmltYXJ5ZGF0YS5jb20N
Cg==


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

* Re: pynfs replay cache test SEQ9f
  2017-10-12 18:32 ` pynfs replay cache test SEQ9f Thomas Haynes
  2017-10-12 19:30   ` Trond Myklebust
@ 2017-10-12 19:49   ` J. Bruce Fields
  2017-10-12 21:39     ` [nfsv4] " Thomas Haynes
  1 sibling, 1 reply; 18+ messages in thread
From: J. Bruce Fields @ 2017-10-12 19:49 UTC (permalink / raw)
  To: Thomas Haynes; +Cc: Mailing List Linux NFS, nfsv4

On Thu, Oct 12, 2017 at 06:32:09PM +0000, Thomas Haynes wrote:
> Hi Bruce,
> 
> In this test:
> 
> def testReplayCache006(t, env):
>    """Send two solo sequence compounds with same seqid
> 
>    FLAGS: sequence all
>    CODE: SEQ9f
>    """
>    c = env.c1.new_client(env.testname(t))
>    sess = c.create_session()
>    res1 = sess.compound([])
>    check(res1)
>    res2 = sess.compound([], cache_this=True, seq_delta=0)
>    check(res2)
>    res1.tag = res2.tag = ""
>    if not nfs4lib.test_equal(res1, res2):
>        fail("Replay results not equal")
> 
> I don't see why the result should be NFS4_OK.
> 
> The first compound does not set sa_cachethis and the second
> does set it. According to RFC5661, the server is not required
> to cache the first request if the client does not request it.
> 
> And if the server does not cache the response, when it gets
> a request to replay it, it can return NFS4ERR_RETRY_UNCACHED_REP:

If I'm reading that section correctly, it can't return
NFS4ERR_RETRY_UNCACHED_REP, that can only be returned on the next op of
the compound (and there is no next op in this case, only the one
SEQUENCE).

So I *think* the only correct options OK or FALSE_RETRY?

> I'm not sure if the test should be fixed to either
> 
> 1) allow either NFS4_OK or NFS4ERR_RETRY_UNCACHED_REP
> 2) just remove the test.

Maybe just add cache_this to the first?

Looks like the following test is off too--I think a server's allowed to
return a cached reply instead of RETRY_UNCACHED_REP?

--b.

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

* Re: [nfsv4] pynfs replay cache test SEQ9f
  2017-10-12 19:49   ` J. Bruce Fields
@ 2017-10-12 21:39     ` Thomas Haynes
  2017-10-12 21:44       ` J. Bruce Fields
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Haynes @ 2017-10-12 21:39 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Mailing List Linux NFS, nfsv4


[-- Attachment #1.1: Type: text/plain, Size: 1772 bytes --]



On Oct 12, 2017, at 12:49 PM, J. Bruce Fields <bfields@fieldses.org<mailto:bfields@fieldses.org>> wrote:

On Thu, Oct 12, 2017 at 06:32:09PM +0000, Thomas Haynes wrote:
Hi Bruce,

In this test:

def testReplayCache006(t, env):
  """Send two solo sequence compounds with same seqid

  FLAGS: sequence all
  CODE: SEQ9f
  """
  c = env.c1.new_client(env.testname(t))
  sess = c.create_session()
  res1 = sess.compound([])
  check(res1)
  res2 = sess.compound([], cache_this=True, seq_delta=0)
  check(res2)
  res1.tag = res2.tag = ""
  if not nfs4lib.test_equal(res1, res2):
      fail("Replay results not equal")

I don't see why the result should be NFS4_OK.

The first compound does not set sa_cachethis and the second
does set it. According to RFC5661, the server is not required
to cache the first request if the client does not request it.

And if the server does not cache the response, when it gets
a request to replay it, it can return NFS4ERR_RETRY_UNCACHED_REP:

If I'm reading that section correctly, it can't return
NFS4ERR_RETRY_UNCACHED_REP, that can only be returned on the next op of
the compound (and there is no next op in this case, only the one
SEQUENCE).

So I *think* the only correct options OK or FALSE_RETRY?


It can’t be OK if the parameters to SEQUENCE differ.



I'm not sure if the test should be fixed to either

1) allow either NFS4_OK or NFS4ERR_RETRY_UNCACHED_REP
2) just remove the test.

Maybe just add cache_this to the first?

Ack. I’ll send in a patch for this approach.


Looks like the following test is off too--I think a server's allowed to
return a cached reply instead of RETRY_UNCACHED_REP?


Yes, it is allowed to do so since it can always cache.


--b.


[-- Attachment #1.2: Type: text/html, Size: 11666 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
nfsv4 mailing list
nfsv4@ietf.org
https://www.ietf.org/mailman/listinfo/nfsv4

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

* Re: pynfs replay cache test SEQ9f
  2017-10-12 21:39     ` [nfsv4] " Thomas Haynes
@ 2017-10-12 21:44       ` J. Bruce Fields
  2017-10-12 22:00         ` Tom Haynes
  0 siblings, 1 reply; 18+ messages in thread
From: J. Bruce Fields @ 2017-10-12 21:44 UTC (permalink / raw)
  To: Thomas Haynes; +Cc: Mailing List Linux NFS, nfsv4

Your mailer's not quoting right, it's a little hard for me to find your
replies.  Wading in:

On Thu, Oct 12, 2017 at 09:39:04PM +0000, Thomas Haynes wrote:
> On Oct 12, 2017, at 12:49 PM, J. Bruce Fields <bfields@fieldses.org<mailto:bfields@fieldses.org>> wrote:
> > So I *think* the only correct options OK or FALSE_RETRY?
> 
> It can’t be OK if the parameters to SEQUENCE differ.

I'm getting that from: "When the replier detects a false retry, it is
permitted (but not always obligated) to return NFS4ERR_FALSE_RETRY in
response to the Sequence operation when it detects a false retry."

If i understand the following language, we're required to return
FALSE_RETRY in the case the rpc credentials of the caller map to
different principals, but not otherwise.

--b

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

* Re: pynfs replay cache test SEQ9f
  2017-10-12 21:44       ` J. Bruce Fields
@ 2017-10-12 22:00         ` Tom Haynes
  2017-10-13  1:52           ` J. Bruce Fields
  0 siblings, 1 reply; 18+ messages in thread
From: Tom Haynes @ 2017-10-12 22:00 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Thomas Haynes, Mailing List Linux NFS, nfsv4

On Thu, Oct 12, 2017 at 05:44:54PM -0400, J. Bruce Fields wrote:
> Your mailer's not quoting right, it's a little hard for me to find your
> replies.  Wading in:
> 
> On Thu, Oct 12, 2017 at 09:39:04PM +0000, Thomas Haynes wrote:
> > On Oct 12, 2017, at 12:49 PM, J. Bruce Fields <bfields@fieldses.org<mailto:bfields@fieldses.org>> wrote:
> > > So I *think* the only correct options OK or FALSE_RETRY?
> > 
> > It can’t be OK if the parameters to SEQUENCE differ.
> 
> I'm getting that from: "When the replier detects a false retry, it is
> permitted (but not always obligated) to return NFS4ERR_FALSE_RETRY in
> response to the Sequence operation when it detects a false retry."

I think you are agreeing with me that OK is not appropriate here?


> 
> If i understand the following language, we're required to return
> FALSE_RETRY in the case the rpc credentials of the caller map to
> different principals, but not otherwise.

This one drove me crazy:

   If a requester sent a Sequence operation with a slot ID and sequence
   ID that are in the reply cache but the replier detected that the
   retried request is not the same as the original request, including a
   retry that has different operations or different arguments in the
   operations from the original

SEQUENCE is not special - both the compounds in this example
only have the SEQUENCE op and they differ only in that in the
first sa_cachethis is False and in the second it is True.

So we have to return FALSE_SEQ_RETRY here...

> 
> --b
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: pynfs replay cache test SEQ9f
  2017-10-12 22:00         ` Tom Haynes
@ 2017-10-13  1:52           ` J. Bruce Fields
  2017-10-13 13:34             ` Trond Myklebust
  0 siblings, 1 reply; 18+ messages in thread
From: J. Bruce Fields @ 2017-10-13  1:52 UTC (permalink / raw)
  To: Tom Haynes; +Cc: Thomas Haynes, Mailing List Linux NFS, nfsv4

On Thu, Oct 12, 2017 at 03:00:51PM -0700, Tom Haynes wrote:
> On Thu, Oct 12, 2017 at 05:44:54PM -0400, J. Bruce Fields wrote:
> > Your mailer's not quoting right, it's a little hard for me to find your
> > replies.  Wading in:
> > 
> > On Thu, Oct 12, 2017 at 09:39:04PM +0000, Thomas Haynes wrote:
> > > On Oct 12, 2017, at 12:49 PM, J. Bruce Fields <bfields@fieldses.org<mailto:bfields@fieldses.org>> wrote:
> > > > So I *think* the only correct options OK or FALSE_RETRY?
> > > 
> > > It can’t be OK if the parameters to SEQUENCE differ.
> > 
> > I'm getting that from: "When the replier detects a false retry, it is
> > permitted (but not always obligated) to return NFS4ERR_FALSE_RETRY in
> > response to the Sequence operation when it detects a false retry."
> 
> I think you are agreeing with me that OK is not appropriate here?

No, I think OK is OK:

> > If i understand the following language, we're required to return
> > FALSE_RETRY in the case the rpc credentials of the caller map to
> > different principals, but not otherwise.
> 
> This one drove me crazy:
> 
>    If a requester sent a Sequence operation with a slot ID and sequence
>    ID that are in the reply cache but the replier detected that the
>    retried request is not the same as the original request, including a
>    retry that has different operations or different arguments in the
>    operations from the original
> 
> SEQUENCE is not special - both the compounds in this example
> only have the SEQUENCE op and they differ only in that in the
> first sa_cachethis is False and in the second it is True.
> 
> So we have to return FALSE_SEQ_RETRY here...

It says "if the replier detected" a difference, not "if there is" a
difference.  So the replier is not required to do such detection.  This
agrees with the "not always obligated" above.

So I think it's allowed for the server to just return an old cached
response here (with the cached OK).  And I can't see any practical
problem that would create--a client shouldn't be sending a different
request with the same (slot, sequence) anyway.  The only potential risk
is the malicious client trying to snoop somebody else's reply cache,
hence the requirement in the case principals differ.

--b.

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

* Re: pynfs replay cache test SEQ9f
  2017-10-13  1:52           ` J. Bruce Fields
@ 2017-10-13 13:34             ` Trond Myklebust
  2017-10-13 15:00               ` bfields
  0 siblings, 1 reply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tsZWJ1c3RAcHJpbWFyeWRhdGEuY29tDQo=


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

* Re: pynfs replay cache test SEQ9f
  2017-10-13 13:34             ` Trond Myklebust
@ 2017-10-13 15:00               ` bfields
  2017-10-13 15:26                 ` Trond Myklebust
  0 siblings, 1 reply; 18+ messages in thread
From: bfields @ 2017-10-13 15:00 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: loghyr, Thomas Haynes, linux-nfs, nfsv4

On Fri, Oct 13, 2017 at 01:34:28PM +0000, Trond Myklebust wrote:
> On Thu, 2017-10-12 at 21:52 -0400, J. Bruce Fields wrote:
> > On Thu, Oct 12, 2017 at 03:00:51PM -0700, Tom Haynes wrote:
> > > On Thu, Oct 12, 2017 at 05:44:54PM -0400, J. Bruce Fields wrote:
> > > > Your mailer's not quoting right, it's a little hard for me to
> > > > find your
> > > > replies.  Wading in:
> > > > 
> > > > On Thu, Oct 12, 2017 at 09:39:04PM +0000, Thomas Haynes wrote:
> > > > > On Oct 12, 2017, at 12:49 PM, J. Bruce Fields <bfields@fieldses
> > > > > .org<mailto:bfields@fieldses.org>> wrote:
> > > > > > So I *think* the only correct options OK or FALSE_RETRY?
> > > > > 
> > > > > It can’t be OK if the parameters to SEQUENCE differ.
> > > > 
> > > > I'm getting that from: "When the replier detects a false retry,
> > > > it is
> > > > permitted (but not always obligated) to return
> > > > NFS4ERR_FALSE_RETRY in
> > > > response to the Sequence operation when it detects a false
> > > > retry."
> > > 
> > > I think you are agreeing with me that OK is not appropriate here?
> > 
> > No, I think OK is OK:
> > 
> > > > If i understand the following language, we're required to return
> > > > FALSE_RETRY in the case the rpc credentials of the caller map to
> > > > different principals, but not otherwise.
> > > 
> > > This one drove me crazy:
> > > 
> > >    If a requester sent a Sequence operation with a slot ID and
> > > sequence
> > >    ID that are in the reply cache but the replier detected that the
> > >    retried request is not the same as the original request,
> > > including a
> > >    retry that has different operations or different arguments in
> > > the
> > >    operations from the original
> > > 
> > > SEQUENCE is not special - both the compounds in this example
> > > only have the SEQUENCE op and they differ only in that in the
> > > first sa_cachethis is False and in the second it is True.
> > > 
> > > So we have to return FALSE_SEQ_RETRY here...
> > 
> > It says "if the replier detected" a difference, not "if there is" a
> > difference.  So the replier is not required to do such
> > detection.  This
> > agrees with the "not always obligated" above.
> > 
> > So I think it's allowed for the server to just return an old cached
> > response here (with the cached OK).  And I can't see any practical
> > problem that would create--a client shouldn't be sending a different
> > request with the same (slot, sequence) anyway.  The only potential
> > risk
> > is the malicious client trying to snoop somebody else's reply cache,
> > hence the requirement in the case principals differ.
> 
> Clients may indeed send a different request with the same slot and
> sequence if they don't know that the server received the last request.
> This is tbe "user pressed ^C" scenario...
> 
> Servers MAY ignore that fact, but they'd be really stupid to do so...

OK, OK, I'll look into fixing the server (I'm pretty sure we get this
wrong).

You've explained the ctrl-C case before and I don't think I understood
it.  I guess otherwise the only way for the client to sort out the
situation would be to retry the original request.  And that requires
keeping the arguments and credentials around to handle potential
retries.  And that's impractical if the process is going away?  OK.

--b.

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

* Re: pynfs replay cache test SEQ9f
  2017-10-13 15:00               ` bfields
@ 2017-10-13 15:26                 ` Trond Myklebust
  2017-10-13 18:50                   ` bfields
  2017-10-16 16:15                   ` [nfsv4] " Frank Filz
  0 siblings, 2 replies; 18+ messages in thread
From: Trond Myklebust @ 2017-10-13 15:26 UTC (permalink / raw)
  To: bfields; +Cc: Thomas Haynes, loghyr, linux-nfs, nfsv4

T24gRnJpLCAyMDE3LTEwLTEzIGF0IDExOjAwIC0wNDAwLCBiZmllbGRzQGZpZWxkc2VzLm9yZyB3
cm90ZToNCj4gT24gRnJpLCBPY3QgMTMsIDIwMTcgYXQgMDE6MzQ6MjhQTSArMDAwMCwgVHJvbmQg
TXlrbGVidXN0IHdyb3RlOg0KPiA+IE9uIFRodSwgMjAxNy0xMC0xMiBhdCAyMTo1MiAtMDQwMCwg
Si4gQnJ1Y2UgRmllbGRzIHdyb3RlOg0KPiA+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cGVyYXRpb24gdGhhdCB3ZQ0KZGlkIG5vdCB3YW50IHRoZSBz
ZXJ2ZXIgdG8gY2FjaGUuDQoNCkkgaGF2ZSBhIHBhdGNoIG91dCB0aGVyZSB0aGF0IGp1c3QgcmVw
bGF5cyBhIFNFUVVFTkNFIG9wIGlmIHdlIGRldGVjdA0KdGhhdCBhbiBSUEMgY2FsbCB3YXMgaW50
ZXJydXB0ZWQuIFRoYXQgc2hvdWxkIGJlIHN1ZmZpY2llbnQgdG8gZGVhbA0Kd2l0aCBzZXJ2ZXJz
IHRoYXQgY2FjaGUgZXZlcnl0aGluZyAod2hldGhlciBvciBub3QgdGhlIGNsaWVudCBzZXRzDQpz
YV9jYWNoZXRoaXMpLCBidXQgZG9uJ3Qgd2FudCB0byBkbyBORlM0RVJSX1NFUV9GQUxTRV9SRVRS
WS4gVGhhdA0KcGFydGljdWxhciBjb21iaW5hdGlvbiBoYXMgYmVlbiBzZWVuIHRvIGJlIGV4dHJl
bWVseSB0b3hpYyB0byB0aGUNCmN1cnJlbnQgY2xpZW50LCBiZWNhdXNlIGl0IGNhbiBnZXQgcmVw
bGF5ZWQgTE9PS1VQIG9yIEdFVEFUVFIgcmVxdWVzdHMNCmFmdGVyIHNvbWVvbmUgcHJlc3NlcyBe
Qy4NCg0KLS0gDQpUcm9uZCBNeWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lciwg
UHJpbWFyeURhdGENCnRyb25kLm15a2xlYnVzdEBwcmltYXJ5ZGF0YS5jb20NCg==


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

* Re: pynfs replay cache test SEQ9f
  2017-10-13 15:26                 ` Trond Myklebust
@ 2017-10-13 18:50                   ` bfields
  2017-10-13 20:19                     ` bfields
  2017-10-17 21:31                     ` bfields
  2017-10-16 16:15                   ` [nfsv4] " Frank Filz
  1 sibling, 2 replies; 18+ messages in thread
From: bfields @ 2017-10-13 18:50 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Thomas Haynes, loghyr, linux-nfs, nfsv4

On Fri, Oct 13, 2017 at 03:26:51PM +0000, Trond Myklebust wrote:
> On Fri, 2017-10-13 at 11:00 -0400, bfields@fieldses.org wrote:
> > OK, OK, I'll look into fixing the server (I'm pretty sure we get this
> > wrong).
> > 
> > You've explained the ctrl-C case before and I don't think I
> > understood
> > it.  I guess otherwise the only way for the client to sort out the
> > situation would be to retry the original request.  And that requires
> > keeping the arguments and credentials around to handle potential
> > retries.  And that's impractical if the process is going away?  OK.
> > 
> 
> Right, we're not going to do that just for data that is just going to
> be tossed away anyway. We already guarantee that non-idempotent
> operations (the ones that we actually do ask the server to cache) are
> guaranteed to complete whether or not the user presses ^C, so this is
> mainly about what happens when somebody interrupts an operation that we
> did not want the server to cache.
> 
> I have a patch out there that just replays a SEQUENCE op if we detect
> that an RPC call was interrupted. That should be sufficient to deal
> with servers that cache everything (whether or not the client sets
> sa_cachethis), but don't want to do NFS4ERR_SEQ_FALSE_RETRY. That
> particular combination has been seen to be extremely toxic to the
> current client, because it can get replayed LOOKUP or GETATTR requests
> after someone presses ^C.

Those all involve uncached compounds with more than one op.  My reading
of knfsd code is that it will return RETRY_UNCACHED_REP in this case,
and I think (I might be misunderstanding) that the client will bump the
slot seqid and retry in that case.  So I *think* you shouldn't be seeing
that problem with knfsd?

--b.

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

* Re: pynfs replay cache test SEQ9f
  2017-10-13 18:50                   ` bfields
@ 2017-10-13 20:19                     ` bfields
  2017-10-17 21:31                     ` bfields
  1 sibling, 0 replies; 18+ messages in thread
From: bfields @ 2017-10-13 20:19 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Thomas Haynes, loghyr, linux-nfs, nfsv4

On Fri, Oct 13, 2017 at 02:50:15PM -0400, bfields@fieldses.org wrote:
> Those all involve uncached compounds with more than one op.  My reading
> of knfsd code is that it will return RETRY_UNCACHED_REP in this case,
> and I think (I might be misunderstanding) that the client will bump the
> slot seqid and retry in that case.  So I *think* you shouldn't be seeing
> that problem with knfsd?

So to bring it back to the original question, I'm still not sure it's
actually a problem if a server returns NFS_OK when cache_this is set
differently betwen two compound calls each containing just a single
SEQUENCE.

But, maybe it's worth at least warning about.

--b.

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

* RE: [nfsv4] pynfs replay cache test SEQ9f
  2017-10-13 15:26                 ` Trond Myklebust
  2017-10-13 18:50                   ` bfields
@ 2017-10-16 16:15                   ` Frank Filz
  1 sibling, 0 replies; 18+ messages in thread
From: Frank Filz @ 2017-10-16 16:15 UTC (permalink / raw)
  To: 'Trond Myklebust', bfields
  Cc: loghyr, linux-nfs, nfsv4, 'Thomas Haynes'

> On Fri, 2017-10-13 at 11:00 -0400, bfields@fieldses.org wrote:
> > On Fri, Oct 13, 2017 at 01:34:28PM +0000, Trond Myklebust wrote:
> > > On Thu, 2017-10-12 at 21:52 -0400, J. Bruce Fields wrote:
> > > > On Thu, Oct 12, 2017 at 03:00:51PM -0700, Tom Haynes wrote:
> > > > > On Thu, Oct 12, 2017 at 05:44:54PM -0400, J. Bruce Fields
> > > > > wrote:
> > > > > > Your mailer's not quoting right, it's a little hard for me to
> > > > > > find your replies.  Wading in:
> > > > > >
> > > > > > On Thu, Oct 12, 2017 at 09:39:04PM +0000, Thomas Haynes
> > > > > > wrote:
> > > > > > > On Oct 12, 2017, at 12:49 PM, J. Bruce Fields <bfields@fiel
> > > > > > > dses .org<mailto:bfields@fieldses.org>> wrote:
> > > > > > > > So I *think* the only correct options OK or FALSE_RETRY?
> > > > > > >
> > > > > > > It can=E2=80=99t be OK if the parameters to SEQUENCE differ.
> > > > > >
> > > > > > I'm getting that from: "When the replier detects a false
> > > > > > retry, it is permitted (but not always obligated) to return
> > > > > > NFS4ERR_FALSE_RETRY in response to the Sequence operation
> when
> > > > > > it detects a false retry."
> > > > >
> > > > > I think you are agreeing with me that OK is not appropriate
> > > > > here?
> > > >
> > > > No, I think OK is OK:
> > > >
> > > > > > If i understand the following language, we're required to
> > > > > > return FALSE_RETRY in the case the rpc credentials of the
> > > > > > caller map to different principals, but not otherwise.
> > > > >
> > > > > This one drove me crazy:
> > > > >
> > > > >    If a requester sent a Sequence operation with a slot ID and
> > > > > sequence
> > > > >    ID that are in the reply cache but the replier detected that
> > > > > the
> > > > >    retried request is not the same as the original request,
> > > > > including a
> > > > >    retry that has different operations or different arguments in
> > > > > the
> > > > >    operations from the original
> > > > >
> > > > > SEQUENCE is not special - both the compounds in this example
> > > > > only have the SEQUENCE op and they differ only in that in the
> > > > > first sa_cachethis is False and in the second it is True.
> > > > >
> > > > > So we have to return FALSE_SEQ_RETRY here...
> > > >
> > > > It says "if the replier detected" a difference, not "if there is"
> > > > a
> > > > difference.  So the replier is not required to do such detection.
> > > > This agrees with the "not always obligated" above.
> > > >
> > > > So I think it's allowed for the server to just return an old
> > > > cached response here (with the cached OK).  And I can't see any
> > > > practical problem that would create--a client shouldn't be sending
> > > > a different request with the same (slot, sequence) anyway.  The
> > > > only potential risk is the malicious client trying to snoop
> > > > somebody else's reply cache, hence the requirement in the case
> > > > principals differ.
> > >
> > > Clients may indeed send a different request with the same slot and
> > > sequence if they don't know that the server received the last
> > > request.
> > > This is tbe "user pressed ^C" scenario...
> > >
> > > Servers MAY ignore that fact, but they'd be really stupid to do
> > > so...
> >
> > OK, OK, I'll look into fixing the server (I'm pretty sure we get this
> > wrong).
> >
> > You've explained the ctrl-C case before and I don't think I understood
> > it.  I guess otherwise the only way for the client to sort out the
> > situation would be to retry the original request.  And that requires
> > keeping the arguments and credentials around to handle potential
> > retries.  And that's impractical if the process is going away?  OK.
> >
> 
> Right, we're not going to do that just for data that is just going to be =
tossed
> away anyway. We already guarantee that non-idempotent operations (the
> ones that we actually do ask the server to cache) are guaranteed to compl=
ete
> whether or not the user presses ^C, so this is mainly about what happens
> when somebody interrupts an operation that we did not want the server to
> cache.
> 
> I have a patch out there that just replays a SEQUENCE op if we detect tha=
t an
> RPC call was interrupted. That should be sufficient to deal with servers =
that
> cache everything (whether or not the client sets sa_cachethis), but don't=

> want to do NFS4ERR_SEQ_FALSE_RETRY. That particular combination has
> been seen to be extremely toxic to the current client, because it can get=

> replayed LOOKUP or GETATTR requests after someone presses ^C.

I'm wondering if Ganesha does this right...

Bruce, if there's something not covered by the pynfs tests, can we make sur=
e to add one?

Frank


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


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

* Re: pynfs replay cache test SEQ9f
  2017-10-13 18:50                   ` bfields
  2017-10-13 20:19                     ` bfields
@ 2017-10-17 21:31                     ` bfields
  1 sibling, 0 replies; 18+ messages in thread
From: bfields @ 2017-10-17 21:31 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Thomas Haynes, loghyr, linux-nfs, nfsv4

On Fri, Oct 13, 2017 at 02:50:15PM -0400, bfields@fieldses.org wrote:
> On Fri, Oct 13, 2017 at 03:26:51PM +0000, Trond Myklebust wrote:
> > On Fri, 2017-10-13 at 11:00 -0400, bfields@fieldses.org wrote:
> > > OK, OK, I'll look into fixing the server (I'm pretty sure we get this
> > > wrong).
> > > 
> > > You've explained the ctrl-C case before and I don't think I
> > > understood
> > > it.  I guess otherwise the only way for the client to sort out the
> > > situation would be to retry the original request.  And that requires
> > > keeping the arguments and credentials around to handle potential
> > > retries.  And that's impractical if the process is going away?  OK.
> > > 
> > 
> > Right, we're not going to do that just for data that is just going to
> > be tossed away anyway. We already guarantee that non-idempotent
> > operations (the ones that we actually do ask the server to cache) are
> > guaranteed to complete whether or not the user presses ^C, so this is
> > mainly about what happens when somebody interrupts an operation that we
> > did not want the server to cache.
> > 
> > I have a patch out there that just replays a SEQUENCE op if we detect
> > that an RPC call was interrupted. That should be sufficient to deal
> > with servers that cache everything (whether or not the client sets
> > sa_cachethis), but don't want to do NFS4ERR_SEQ_FALSE_RETRY. That
> > particular combination has been seen to be extremely toxic to the
> > current client, because it can get replayed LOOKUP or GETATTR requests
> > after someone presses ^C.
> 
> Those all involve uncached compounds with more than one op.  My reading
> of knfsd code is that it will return RETRY_UNCACHED_REP in this case,
> and I think (I might be misunderstanding) that the client will bump the
> slot seqid and retry in that case.  So I *think* you shouldn't be seeing
> that problem with knfsd?

Argh, no, you're sending a bare SEQUENCE so of course there's just one
op.

And looking at Olga's COPY example and the code....  The server gets
confused in this case and returns a reply to the SEQUENCE, nothing else,
but sets the reply's opcnt to the count taken from the original call,
for some reason.

So, the server's returning a corrupt reply.  It needs to return a reply
that's actually legal xdr and SEQUENCE results that match the call.
Beyond that it probably doesn't matter exactly what it returns--either
it handles it as a replay and doesn't bump the seqid, or a new call and
does, but either way the seqid ends up in the same place, which is the
goal here.  OK.

--b.

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

* Re: [PATCH] Args need to be the same for replay cache
  2017-10-11 16:48 [PATCH] Args need to be the same for replay cache Thomas Haynes
  2017-10-12 18:32 ` pynfs replay cache test SEQ9f Thomas Haynes
@ 2018-04-10 19:49 ` J. Bruce Fields
  2018-04-24 20:10   ` Olga Kornievskaia
  1 sibling, 1 reply; 18+ messages in thread
From: J. Bruce Fields @ 2018-04-10 19:49 UTC (permalink / raw)
  To: Thomas Haynes; +Cc: Mailing List Linux NFS

This prompted a long discussion on the correct server behavior in the
case of false retries of bare SEQUENCE calls, which was kind of
irrelevant to your actual pynfs patch.  Somebody just reminded me that I
never applied that.

Applied now, thanks.--b.

On Wed, Oct 11, 2017 at 09:48:22AM -0700, Thomas Haynes wrote:
> From: Tom Haynes <loghyr@primarydata.com>
> 
> 2.10.6.1.3.1.  False Retry
> 
>   If a requester sent a Sequence operation with a slot ID and sequence
>   ID that are in the reply cache but the replier detected that the
>   retried request is not the same as the original request, including a
>   retry that has different operations or different arguments in the
>   operations from the original and a retry that uses a different
>    principal in the RPC request's credential field that translates to a
>   different user, then this is a false retry.  When the replier detects
>   a false retry, it is permitted (but not always obligated) to return
>   NFS4ERR_SEQ_FALSE_RETRY in response to the Sequence operation when it
>   detects a false retry.
> 
> Or in other words, sa_cachethis needs to be set or a
> server can respond with an error.
> 
> Signed-off-by: Tom Haynes <loghyr@primarydata.com>
> ---
>  nfs4.1/server41tests/st_sequence.py | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/nfs4.1/server41tests/st_sequence.py b/nfs4.1/server41tests/st_sequence.py
> index d8d460c..e1e5f06 100644
> --- a/nfs4.1/server41tests/st_sequence.py
> +++ b/nfs4.1/server41tests/st_sequence.py
> @@ -115,7 +115,7 @@ def testReplayCache001(t, env):
>      sess1 = c1.create_session()
>      res1 = sess1.compound([op.putrootfh()], cache_this=True)
>      check(res1)
> -    res2 = sess1.compound([op.putrootfh()], seq_delta=0)
> +    res2 = sess1.compound([op.putrootfh()], cache_this=True, seq_delta=0)
>      check(res2)
>      res1.tag = res2.tag = ""
>      if not nfs4lib.test_equal(res1, res2):
> @@ -137,7 +137,7 @@ def testReplayCache002(t, env):
>            op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
>      res1 = sess1.compound(ops, cache_this=True)
>      check(res1)
> -    res2 = sess1.compound(ops, seq_delta=0)
> +    res2 = sess1.compound(ops, cache_this=True, seq_delta=0)
>      check(res2)
>      res1.tag = res2.tag = ""
>      if not nfs4lib.test_equal(res1, res2):
> @@ -158,7 +158,7 @@ def testReplayCache003(t, env):
>      sess1 = c1.create_session()
>      res1 = sess1.compound([op.putrootfh(), op.lookup("")], cache_this=True)
>      check(res1, NFS4ERR_INVAL)
> -    res2 = sess1.compound([op.putrootfh(), op.lookup("")], seq_delta=0)
> +    res2 = sess1.compound([op.putrootfh(), op.lookup("")], cache_this=True, seq_delta=0)
>      check(res2, NFS4ERR_INVAL)
>      res1.tag = res2.tag = ""
>      if not nfs4lib.test_equal(res1, res2):
> @@ -176,7 +176,7 @@ def testReplayCache004(t, env):
>      ops += [op.savefh(), op.rename("", "foo")]
>      res1 = sess1.compound(ops, cache_this=True)
>      check(res1, NFS4ERR_INVAL)
> -    res2 = sess1.compound(ops, seq_delta=0)
> +    res2 = sess1.compound(ops, cache_this=True, seq_delta=0)
>      check(res2, NFS4ERR_INVAL)
>      res1.tag = res2.tag = ""
>      if not nfs4lib.test_equal(res1, res2):
> @@ -192,7 +192,7 @@ def testReplayCache005(t, env):
>      sess1 = c1.create_session()
>      res1 = sess1.compound([op.illegal()], cache_this=True)
>      check(res1, NFS4ERR_OP_ILLEGAL)
> -    res2 = sess1.compound([op.illegal()], seq_delta=0)
> +    res2 = sess1.compound([op.illegal()], cache_this=True, seq_delta=0)
>      check(res2, NFS4ERR_OP_ILLEGAL)
>      res1.tag = res2.tag = ""
>      if not nfs4lib.test_equal(res1, res2):
> @@ -208,7 +208,7 @@ def testReplayCache006(t, env):
>      sess = c.create_session()
>      res1 = sess.compound([])
>      check(res1)
> -    res2 = sess.compound([], seq_delta=0)
> +    res2 = sess.compound([], cache_this=True, seq_delta=0)
>      check(res2)
>      res1.tag = res2.tag = ""
>      if not nfs4lib.test_equal(res1, res2):
> -- 
> 2.3.6

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

* Re: [PATCH] Args need to be the same for replay cache
  2018-04-10 19:49 ` [PATCH] Args need to be the same for replay cache J. Bruce Fields
@ 2018-04-24 20:10   ` Olga Kornievskaia
  2018-04-24 22:16     ` J. Bruce Fields
  0 siblings, 1 reply; 18+ messages in thread
From: Olga Kornievskaia @ 2018-04-24 20:10 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Mailing List Linux NFS

Hi Bruce,

Do you by any chance have a reference to this discussion?

I would like to reference it. For now I'm hijacking this thread to
bring this up. I'm still concerned about the case where client sent a
request and slot got interrupted (so by default the client doesn't
increment the seq#). Then the client re-used the slot for the same
kind of operation (WRITE is very interesting) with same arguments but
say different FH. Is the server obligated the cache the whole call to
address and check that? You have a patch to check for false retries
that checks for different creds but I don't think you have something
that would catch this case?

Thank you.


On Tue, Apr 10, 2018 at 3:49 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> This prompted a long discussion on the correct server behavior in the
> case of false retries of bare SEQUENCE calls, which was kind of
> irrelevant to your actual pynfs patch.  Somebody just reminded me that I
> never applied that.
>
> Applied now, thanks.--b.
>
> On Wed, Oct 11, 2017 at 09:48:22AM -0700, Thomas Haynes wrote:
>> From: Tom Haynes <loghyr@primarydata.com>
>>
>> 2.10.6.1.3.1.  False Retry
>>
>>   If a requester sent a Sequence operation with a slot ID and sequence
>>   ID that are in the reply cache but the replier detected that the
>>   retried request is not the same as the original request, including a
>>   retry that has different operations or different arguments in the
>>   operations from the original and a retry that uses a different
>>    principal in the RPC request's credential field that translates to a
>>   different user, then this is a false retry.  When the replier detects
>>   a false retry, it is permitted (but not always obligated) to return
>>   NFS4ERR_SEQ_FALSE_RETRY in response to the Sequence operation when it
>>   detects a false retry.
>>
>> Or in other words, sa_cachethis needs to be set or a
>> server can respond with an error.
>>
>> Signed-off-by: Tom Haynes <loghyr@primarydata.com>
>> ---
>>  nfs4.1/server41tests/st_sequence.py | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/nfs4.1/server41tests/st_sequence.py b/nfs4.1/server41tests/st_sequence.py
>> index d8d460c..e1e5f06 100644
>> --- a/nfs4.1/server41tests/st_sequence.py
>> +++ b/nfs4.1/server41tests/st_sequence.py
>> @@ -115,7 +115,7 @@ def testReplayCache001(t, env):
>>      sess1 = c1.create_session()
>>      res1 = sess1.compound([op.putrootfh()], cache_this=True)
>>      check(res1)
>> -    res2 = sess1.compound([op.putrootfh()], seq_delta=0)
>> +    res2 = sess1.compound([op.putrootfh()], cache_this=True, seq_delta=0)
>>      check(res2)
>>      res1.tag = res2.tag = ""
>>      if not nfs4lib.test_equal(res1, res2):
>> @@ -137,7 +137,7 @@ def testReplayCache002(t, env):
>>            op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
>>      res1 = sess1.compound(ops, cache_this=True)
>>      check(res1)
>> -    res2 = sess1.compound(ops, seq_delta=0)
>> +    res2 = sess1.compound(ops, cache_this=True, seq_delta=0)
>>      check(res2)
>>      res1.tag = res2.tag = ""
>>      if not nfs4lib.test_equal(res1, res2):
>> @@ -158,7 +158,7 @@ def testReplayCache003(t, env):
>>      sess1 = c1.create_session()
>>      res1 = sess1.compound([op.putrootfh(), op.lookup("")], cache_this=True)
>>      check(res1, NFS4ERR_INVAL)
>> -    res2 = sess1.compound([op.putrootfh(), op.lookup("")], seq_delta=0)
>> +    res2 = sess1.compound([op.putrootfh(), op.lookup("")], cache_this=True, seq_delta=0)
>>      check(res2, NFS4ERR_INVAL)
>>      res1.tag = res2.tag = ""
>>      if not nfs4lib.test_equal(res1, res2):
>> @@ -176,7 +176,7 @@ def testReplayCache004(t, env):
>>      ops += [op.savefh(), op.rename("", "foo")]
>>      res1 = sess1.compound(ops, cache_this=True)
>>      check(res1, NFS4ERR_INVAL)
>> -    res2 = sess1.compound(ops, seq_delta=0)
>> +    res2 = sess1.compound(ops, cache_this=True, seq_delta=0)
>>      check(res2, NFS4ERR_INVAL)
>>      res1.tag = res2.tag = ""
>>      if not nfs4lib.test_equal(res1, res2):
>> @@ -192,7 +192,7 @@ def testReplayCache005(t, env):
>>      sess1 = c1.create_session()
>>      res1 = sess1.compound([op.illegal()], cache_this=True)
>>      check(res1, NFS4ERR_OP_ILLEGAL)
>> -    res2 = sess1.compound([op.illegal()], seq_delta=0)
>> +    res2 = sess1.compound([op.illegal()], cache_this=True, seq_delta=0)
>>      check(res2, NFS4ERR_OP_ILLEGAL)
>>      res1.tag = res2.tag = ""
>>      if not nfs4lib.test_equal(res1, res2):
>> @@ -208,7 +208,7 @@ def testReplayCache006(t, env):
>>      sess = c.create_session()
>>      res1 = sess.compound([])
>>      check(res1)
>> -    res2 = sess.compound([], seq_delta=0)
>> +    res2 = sess.compound([], cache_this=True, seq_delta=0)
>>      check(res2)
>>      res1.tag = res2.tag = ""
>>      if not nfs4lib.test_equal(res1, res2):
>> --
>> 2.3.6
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Args need to be the same for replay cache
  2018-04-24 20:10   ` Olga Kornievskaia
@ 2018-04-24 22:16     ` J. Bruce Fields
  0 siblings, 0 replies; 18+ messages in thread
From: J. Bruce Fields @ 2018-04-24 22:16 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: Mailing List Linux NFS

On Tue, Apr 24, 2018 at 04:10:29PM -0400, Olga Kornievskaia wrote:
> Do you by any chance have a reference to this discussion?

This:
	http://lkml.kernel.org/r/1507740502-5151-1-git-send-email-Thomas.Haynes@primarydata.com

and this:

	http://lkml.kernel.org/r/E0161195-9F4A-4B36-A71D-6A924498C893@primarydata.com

and followups.

> I would like to reference it. For now I'm hijacking this thread to
> bring this up. I'm still concerned about the case where client sent a
> request and slot got interrupted (so by default the client doesn't
> increment the seq#). Then the client re-used the slot for the same
> kind of operation (WRITE is very interesting) with same arguments but
> say different FH. Is the server obligated the cache the whole call to
> address and check that? You have a patch to check for false retries
> that checks for different creds but I don't think you have something
> that would catch this case?

Right.  I don't believe the spec requires us to catch false retries in
every possible case.  That may mean we return a pretty bizarre reply
that doesn't match the request, but that's the client's own fault....

--b.

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

end of thread, other threads:[~2018-04-24 22:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 16:48 [PATCH] Args need to be the same for replay cache Thomas Haynes
2017-10-12 18:32 ` pynfs replay cache test SEQ9f Thomas Haynes
2017-10-12 19:30   ` Trond Myklebust
2017-10-12 19:49   ` J. Bruce Fields
2017-10-12 21:39     ` [nfsv4] " Thomas Haynes
2017-10-12 21:44       ` J. Bruce Fields
2017-10-12 22:00         ` Tom Haynes
2017-10-13  1:52           ` J. Bruce Fields
2017-10-13 13:34             ` Trond Myklebust
2017-10-13 15:00               ` bfields
2017-10-13 15:26                 ` Trond Myklebust
2017-10-13 18:50                   ` bfields
2017-10-13 20:19                     ` bfields
2017-10-17 21:31                     ` bfields
2017-10-16 16:15                   ` [nfsv4] " Frank Filz
2018-04-10 19:49 ` [PATCH] Args need to be the same for replay cache J. Bruce Fields
2018-04-24 20:10   ` Olga Kornievskaia
2018-04-24 22:16     ` J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.