All of lore.kernel.org
 help / color / mirror / Atom feed
* NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
@ 2018-09-04 22:47 NeilBrown
  2018-09-04 23:11 ` Trond Myklebust
  0 siblings, 1 reply; 10+ messages in thread
From: NeilBrown @ 2018-09-04 22:47 UTC (permalink / raw)
  To: linux-nfs

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]


With NFSv4.1, the server specifies max_rqst_sz and max_resp_sz in the
reply to CREATE session.

If the client finds it needs to call nfs4_reset_session(), it might get
smaller sizes back, so any pending read/writes would need to be resized.

However, I cannot see how the retry handling for reads/writes has any
chance to change the size.  It looks like a request is broken up to
match the original ->rsize and ->wsize, then those individual IO
requests can be retried, but the higher level request is never
re-evaluated in light of a new size.

Am I missing something, or is this not supported at present?
If it isn't supported, any suggestions on how best to handle a
reduction of the rsize/wsize ??

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-04 22:47 NFSv4.1 session reset needs to update ->rsize and ->wsize - how??? NeilBrown
@ 2018-09-04 23:11 ` Trond Myklebust
  2018-09-05  0:02   ` NeilBrown
  0 siblings, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2018-09-04 23:11 UTC (permalink / raw)
  To: neilb, linux-nfs

T24gV2VkLCAyMDE4LTA5LTA1IGF0IDA4OjQ3ICsxMDAwLCBOZWlsQnJvd24gd3JvdGU6DQo+IFdp
dGggTkZTdjQuMSwgdGhlIHNlcnZlciBzcGVjaWZpZXMgbWF4X3Jxc3Rfc3ogYW5kIG1heF9yZXNw
X3N6IGluIHRoZQ0KPiByZXBseSB0byBDUkVBVEUgc2Vzc2lvbi4NCj4gDQo+IElmIHRoZSBjbGll
bnQgZmluZHMgaXQgbmVlZHMgdG8gY2FsbCBuZnM0X3Jlc2V0X3Nlc3Npb24oKSwgaXQgbWlnaHQ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.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-04 23:11 ` Trond Myklebust
@ 2018-09-05  0:02   ` NeilBrown
  2018-09-05 13:44     ` Olga Kornievskaia
  0 siblings, 1 reply; 10+ messages in thread
From: NeilBrown @ 2018-09-05  0:02 UTC (permalink / raw)
  To: Trond Myklebust, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 2296 bytes --]

On Tue, Sep 04 2018, Trond Myklebust wrote:

> On Wed, 2018-09-05 at 08:47 +1000, NeilBrown wrote:
>> With NFSv4.1, the server specifies max_rqst_sz and max_resp_sz in the
>> reply to CREATE session.
>> 
>> If the client finds it needs to call nfs4_reset_session(), it might
>> get
>> smaller sizes back, so any pending read/writes would need to be
>> resized.
>> 
>> However, I cannot see how the retry handling for reads/writes has any
>> chance to change the size.  It looks like a request is broken up to
>> match the original ->rsize and ->wsize, then those individual IO
>> requests can be retried, but the higher level request is never
>> re-evaluated in light of a new size.
>> 
>> Am I missing something, or is this not supported at present?
>> If it isn't supported, any suggestions on how best to handle a
>> reduction of the rsize/wsize ??
>> 
>
> Why would a sane server want to do this?

Why would a sane protocol support it? :-)

I have a network trace of SLE11-SP4 (3.0 based) talking to "a NetApp
appliance".
It sends a 64K write and gets NFS4ERR_REQ_TOO_BIG.
It then closes the file (getting NFS4ERR_SEQ_MISORDERED even though it
used a seq number 1 more than the WRITE request), and then
DESTROY_SESSION and CREATE_SESSION.
The CREATE_SESSION gets "max req size" of 33812 and "max resp size" of
33672.
It then opens the file again and retries the 64K write....

I have a separate trace showing the initial mount where the sizes are 71680
and 81920.

I don't have a trace where it stops working, but reportedly writes work
smoothly for some hours after a mount, but then suddenly stop working.

The CREATE_SESSION *call* requests I see have the small (32K) sizes, but
presumably they are the result of a previous CREATE_SESSION reply giving
a small value.

I just had a thought.
If one session is shared by two "struct nfs_server" with different
->rsize or ->wsize, then the session might get set up with the smaller
size, and the mount using the larger size will get confused.
In 3.0 (and even 3.10) nfs4_init_session() limits the requested session
parameters to ->rsize and ->wsize.
That changed in 18aad3d552c7.

Maybe I just need to remove that code from nfs4_init_session().
I'll give it a try.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-05  0:02   ` NeilBrown
@ 2018-09-05 13:44     ` Olga Kornievskaia
  2018-09-05 15:12       ` Trond Myklebust
  2018-09-05 21:12       ` NeilBrown
  0 siblings, 2 replies; 10+ messages in thread
From: Olga Kornievskaia @ 2018-09-05 13:44 UTC (permalink / raw)
  To: NeilBrown; +Cc: Trond Myklebust, linux-nfs

On Tue, Sep 4, 2018 at 8:04 PM NeilBrown <neilb@suse.com> wrote:
>
> On Tue, Sep 04 2018, Trond Myklebust wrote:
>
> > On Wed, 2018-09-05 at 08:47 +1000, NeilBrown wrote:
> >> With NFSv4.1, the server specifies max_rqst_sz and max_resp_sz in the
> >> reply to CREATE session.
> >>
> >> If the client finds it needs to call nfs4_reset_session(), it might
> >> get
> >> smaller sizes back, so any pending read/writes would need to be
> >> resized.
> >>
> >> However, I cannot see how the retry handling for reads/writes has any
> >> chance to change the size.  It looks like a request is broken up to
> >> match the original ->rsize and ->wsize, then those individual IO
> >> requests can be retried, but the higher level request is never
> >> re-evaluated in light of a new size.
> >>
> >> Am I missing something, or is this not supported at present?
> >> If it isn't supported, any suggestions on how best to handle a
> >> reduction of the rsize/wsize ??
> >>
> >
> > Why would a sane server want to do this?
>
> Why would a sane protocol support it? :-)
>
> I have a network trace of SLE11-SP4 (3.0 based) talking to "a NetApp
> appliance".
> It sends a 64K write and gets NFS4ERR_REQ_TOO_BIG.
> It then closes the file (getting NFS4ERR_SEQ_MISORDERED even though it
> used a seq number 1 more than the WRITE request), and then
> DESTROY_SESSION and CREATE_SESSION.
> The CREATE_SESSION gets "max req size" of 33812 and "max resp size" of
> 33672.
> It then opens the file again and retries the 64K write....
>
> I have a separate trace showing the initial mount where the sizes are 71680
> and 81920.
>
> I don't have a trace where it stops working, but reportedly writes work
> smoothly for some hours after a mount, but then suddenly stop working.
>
> The CREATE_SESSION *call* requests I see have the small (32K) sizes, but
> presumably they are the result of a previous CREATE_SESSION reply giving
> a small value.
>
> I just had a thought.
> If one session is shared by two "struct nfs_server" with different
> ->rsize or ->wsize, then the session might get set up with the smaller
> size, and the mount using the larger size will get confused.
> In 3.0 (and even 3.10) nfs4_init_session() limits the requested session
> parameters to ->rsize and ->wsize.
> That changed in 18aad3d552c7.
>
> Maybe I just need to remove that code from nfs4_init_session().
> I'll give it a try.
>

Neil, does the code have this commit?

commit 033853325fe3bdc70819a8b97915bd3bca41d3af
Author: Olga Kornievskaia <kolga@netapp.com>
Date:   Wed Mar 8 14:39:15 2017 -0500

    NFSv4.1 respect server's max size in CREATE_SESSION

    Currently client doesn't respect max sizes server returns in CREATE_SESSION.
    nfs4_session_set_rwsize() gets called and server->rsize, server->wsize are 0
    so they never get set to the sizes returned by the server.

    Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

> Thanks,
> NeilBrown

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-05 13:44     ` Olga Kornievskaia
@ 2018-09-05 15:12       ` Trond Myklebust
  2018-09-05 15:46         ` Olga Kornievskaia
  2018-09-05 21:12       ` NeilBrown
  1 sibling, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2018-09-05 15:12 UTC (permalink / raw)
  To: neilb, aglo; +Cc: linux-nfs

T24gV2VkLCAyMDE4LTA5LTA1IGF0IDA5OjQ0IC0wNDAwLCBPbGdhIEtvcm5pZXZza2FpYSB3cm90
ZToNCj4gY29tbWl0IDAzMzg1MzMyNWZlM2JkYzcwODE5YThiOTc5MTViZDNiY2E0MWQzYWYNCj4g
QXV0aG9yOiBPbGdhIEtvcm5pZXZza2FpYSA8a29s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HdlIGFjdHVhbGx5IHNldCB0aGUgci93c2l6ZSBpbg0KdGhlIGNhbGwgdG8gbmZz
X3Byb2JlX2ZzaW5mbygpLiBObz8NCg0KDQotLSANClRyb25kIE15a2xlYnVzdA0KTGludXggTkZT
IGNsaWVudCBtYWludGFpbmVyLCBIYW1tZXJzcGFjZQ0KdHJvbmQubXlrbGVidXN0QGhhbW1lcnNw
YWNlLmNvbQ0KDQoNCg==

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-05 15:12       ` Trond Myklebust
@ 2018-09-05 15:46         ` Olga Kornievskaia
  0 siblings, 0 replies; 10+ messages in thread
From: Olga Kornievskaia @ 2018-09-05 15:46 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: NeilBrown, linux-nfs

On Wed, Sep 5, 2018 at 11:12 AM Trond Myklebust <trondmy@hammerspace.com> wrote:
>
> On Wed, 2018-09-05 at 09:44 -0400, Olga Kornievskaia wrote:
> > commit 033853325fe3bdc70819a8b97915bd3bca41d3af
> > Author: Olga Kornievskaia <kolga@netapp.com>
> > Date:   Wed Mar 8 14:39:15 2017 -0500
> >
> >     NFSv4.1 respect server's max size in CREATE_SESSION
> >
> >     Currently client doesn't respect max sizes server returns in
> > CREATE_SESSION.
> >     nfs4_session_set_rwsize() gets called and server->rsize, server-
> > >wsize are 0
> >     so they never get set to the sizes returned by the server.
> >
> >     Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> >     Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >
>
> Olga, I'm confused by that patch. It appears to assume that we should
> be using the CREATE_SESSION, request/response limits as default values
> instead of as limits?
>
> AFAICS, the real problem there is that nfs4_server_common_setup() is
> calling nfs4_session_set_rwsize() before we actually set the r/wsize in
> the call to nfs_probe_fsinfo(). No?

I didn't know that nfs_probe_fsinfo() set the server->r/wsize. I
thought it was only set in nfs4_session_set_rwsize() to the values
from the session attributes.

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-05 13:44     ` Olga Kornievskaia
  2018-09-05 15:12       ` Trond Myklebust
@ 2018-09-05 21:12       ` NeilBrown
  2018-09-05 21:56         ` Trond Myklebust
  2018-09-06 17:03         ` Olga Kornievskaia
  1 sibling, 2 replies; 10+ messages in thread
From: NeilBrown @ 2018-09-05 21:12 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: Trond Myklebust, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 3529 bytes --]

On Wed, Sep 05 2018, Olga Kornievskaia wrote:

> On Tue, Sep 4, 2018 at 8:04 PM NeilBrown <neilb@suse.com> wrote:
>>
>> On Tue, Sep 04 2018, Trond Myklebust wrote:
>>
>> > On Wed, 2018-09-05 at 08:47 +1000, NeilBrown wrote:
>> >> With NFSv4.1, the server specifies max_rqst_sz and max_resp_sz in the
>> >> reply to CREATE session.
>> >>
>> >> If the client finds it needs to call nfs4_reset_session(), it might
>> >> get
>> >> smaller sizes back, so any pending read/writes would need to be
>> >> resized.
>> >>
>> >> However, I cannot see how the retry handling for reads/writes has any
>> >> chance to change the size.  It looks like a request is broken up to
>> >> match the original ->rsize and ->wsize, then those individual IO
>> >> requests can be retried, but the higher level request is never
>> >> re-evaluated in light of a new size.
>> >>
>> >> Am I missing something, or is this not supported at present?
>> >> If it isn't supported, any suggestions on how best to handle a
>> >> reduction of the rsize/wsize ??
>> >>
>> >
>> > Why would a sane server want to do this?
>>
>> Why would a sane protocol support it? :-)
>>
>> I have a network trace of SLE11-SP4 (3.0 based) talking to "a NetApp
>> appliance".
>> It sends a 64K write and gets NFS4ERR_REQ_TOO_BIG.
>> It then closes the file (getting NFS4ERR_SEQ_MISORDERED even though it
>> used a seq number 1 more than the WRITE request), and then
>> DESTROY_SESSION and CREATE_SESSION.
>> The CREATE_SESSION gets "max req size" of 33812 and "max resp size" of
>> 33672.
>> It then opens the file again and retries the 64K write....
>>
>> I have a separate trace showing the initial mount where the sizes are 71680
>> and 81920.
>>
>> I don't have a trace where it stops working, but reportedly writes work
>> smoothly for some hours after a mount, but then suddenly stop working.
>>
>> The CREATE_SESSION *call* requests I see have the small (32K) sizes, but
>> presumably they are the result of a previous CREATE_SESSION reply giving
>> a small value.
>>
>> I just had a thought.
>> If one session is shared by two "struct nfs_server" with different
>> ->rsize or ->wsize, then the session might get set up with the smaller
>> size, and the mount using the larger size will get confused.
>> In 3.0 (and even 3.10) nfs4_init_session() limits the requested session
>> parameters to ->rsize and ->wsize.
>> That changed in 18aad3d552c7.
>>
>> Maybe I just need to remove that code from nfs4_init_session().
>> I'll give it a try.
>>
>
> Neil, does the code have this commit?
>
> commit 033853325fe3bdc70819a8b97915bd3bca41d3af
> Author: Olga Kornievskaia <kolga@netapp.com>
> Date:   Wed Mar 8 14:39:15 2017 -0500
>
>     NFSv4.1 respect server's max size in CREATE_SESSION
>
>     Currently client doesn't respect max sizes server returns in CREATE_SESSION.
>     nfs4_session_set_rwsize() gets called and server->rsize, server->wsize are 0
>     so they never get set to the sizes returned by the server.
>
>     Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
>     Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
>
>> Thanks,
>> NeilBrown

Thanks for the suggestion.
The kernel doesn't have that patch, but I don't think it is relevant.
The ->rsize does have a suitable value - it isn't zero.
The problem is that the session limit appears to change, and the client
doesn't adjust to the change.

My current theory is that the client actually requested the change,
though on behalf of a different filesystem using the same session.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-05 21:12       ` NeilBrown
@ 2018-09-05 21:56         ` Trond Myklebust
  2018-09-05 22:10           ` NeilBrown
  2018-09-06 17:03         ` Olga Kornievskaia
  1 sibling, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2018-09-05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ibGVtIGlzIHRoYXQgdGhlIHNl
c3Npb24gbGltaXQgYXBwZWFycyB0byBjaGFuZ2UsIGFuZCB0aGUNCj4gY2xpZW50DQo+IGRvZXNu
J3QgYWRqdXN0IHRvIHRoZSBjaGFuZ2UuDQo+IA0KPiBNeSBjdXJyZW50IHRoZW9yeSBpcyB0aGF0
IHRoZSBjbGllbnQgYWN0dWFsbHkgcmVxdWVzdGVkIHRoZSBjaGFuZ2UsDQo+IHRob3VnaCBvbiBi
ZWhhbGYgb2YgYSBkaWZmZXJlbnQgZmlsZXN5c3RlbSB1c2luZyB0aGUgc2FtZSBzZXNzaW9uLg0K
PiANCg0KU28gcGVyaGFwcyB0aGUgcmlnaHQgdGhpbmcgdG8gZG8gdGhlbiwgaXMgdG8gYWR2ZXJ0
aXNlIGEgc2Vzc2lvbiBtYXgNCnJlc3BvbnNlL3JlcGx5IHNpemUgb2YgTkZTX01BWF9GSUxFX0lP
X1NJWkUgKw0KbWF4KG5mczQxX21heHJlYWRfb3ZlcmhlYWQsbmZzNDFfbWF4d3JpdGVfb3Zlcmhl
YWQpIGFuZCBqdXN0IGV4cGVjdCB0aGUNCnNlcnZlciBuZWdvdGlhdGUgdGhhdCB2YWx1ZSBkb3du
IGlmIGl0IG5lZWRzIHRvPw0KDQotLSANClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVu
dCBtYWludGFpbmVyLCBIYW1tZXJzcGFjZQ0KdHJvbmQubXlrbGVidXN0QGhhbW1lcnNwYWNlLmNv
bQ0KDQoNCg==

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-05 21:56         ` Trond Myklebust
@ 2018-09-05 22:10           ` NeilBrown
  0 siblings, 0 replies; 10+ messages in thread
From: NeilBrown @ 2018-09-05 22:10 UTC (permalink / raw)
  To: Trond Myklebust, aglo; +Cc: linux-nfs

[-- Attachment #1: Type: text/plain, Size: 4841 bytes --]

On Wed, Sep 05 2018, Trond Myklebust wrote:

> On Thu, 2018-09-06 at 07:12 +1000, NeilBrown wrote:
>> On Wed, Sep 05 2018, Olga Kornievskaia wrote:
>> 
>> > On Tue, Sep 4, 2018 at 8:04 PM NeilBrown <neilb@suse.com> wrote:
>> > > 
>> > > On Tue, Sep 04 2018, Trond Myklebust wrote:
>> > > 
>> > > > On Wed, 2018-09-05 at 08:47 +1000, NeilBrown wrote:
>> > > > > With NFSv4.1, the server specifies max_rqst_sz and
>> > > > > max_resp_sz in the
>> > > > > reply to CREATE session.
>> > > > > 
>> > > > > If the client finds it needs to call nfs4_reset_session(), it
>> > > > > might
>> > > > > get
>> > > > > smaller sizes back, so any pending read/writes would need to
>> > > > > be
>> > > > > resized.
>> > > > > 
>> > > > > However, I cannot see how the retry handling for reads/writes
>> > > > > has any
>> > > > > chance to change the size.  It looks like a request is broken
>> > > > > up to
>> > > > > match the original ->rsize and ->wsize, then those individual
>> > > > > IO
>> > > > > requests can be retried, but the higher level request is
>> > > > > never
>> > > > > re-evaluated in light of a new size.
>> > > > > 
>> > > > > Am I missing something, or is this not supported at present?
>> > > > > If it isn't supported, any suggestions on how best to handle
>> > > > > a
>> > > > > reduction of the rsize/wsize ??
>> > > > > 
>> > > > 
>> > > > Why would a sane server want to do this?
>> > > 
>> > > Why would a sane protocol support it? :-)
>> > > 
>> > > I have a network trace of SLE11-SP4 (3.0 based) talking to "a
>> > > NetApp
>> > > appliance".
>> > > It sends a 64K write and gets NFS4ERR_REQ_TOO_BIG.
>> > > It then closes the file (getting NFS4ERR_SEQ_MISORDERED even
>> > > though it
>> > > used a seq number 1 more than the WRITE request), and then
>> > > DESTROY_SESSION and CREATE_SESSION.
>> > > The CREATE_SESSION gets "max req size" of 33812 and "max resp
>> > > size" of
>> > > 33672.
>> > > It then opens the file again and retries the 64K write....
>> > > 
>> > > I have a separate trace showing the initial mount where the sizes
>> > > are 71680
>> > > and 81920.
>> > > 
>> > > I don't have a trace where it stops working, but reportedly
>> > > writes work
>> > > smoothly for some hours after a mount, but then suddenly stop
>> > > working.
>> > > 
>> > > The CREATE_SESSION *call* requests I see have the small (32K)
>> > > sizes, but
>> > > presumably they are the result of a previous CREATE_SESSION reply
>> > > giving
>> > > a small value.
>> > > 
>> > > I just had a thought.
>> > > If one session is shared by two "struct nfs_server" with
>> > > different
>> > > ->rsize or ->wsize, then the session might get set up with the
>> > > smaller
>> > > size, and the mount using the larger size will get confused.
>> > > In 3.0 (and even 3.10) nfs4_init_session() limits the requested
>> > > session
>> > > parameters to ->rsize and ->wsize.
>> > > That changed in 18aad3d552c7.
>> > > 
>> > > Maybe I just need to remove that code from nfs4_init_session().
>> > > I'll give it a try.
>> > > 
>> > 
>> > Neil, does the code have this commit?
>> > 
>> > commit 033853325fe3bdc70819a8b97915bd3bca41d3af
>> > Author: Olga Kornievskaia <kolga@netapp.com>
>> > Date:   Wed Mar 8 14:39:15 2017 -0500
>> > 
>> >     NFSv4.1 respect server's max size in CREATE_SESSION
>> > 
>> >     Currently client doesn't respect max sizes server returns in
>> > CREATE_SESSION.
>> >     nfs4_session_set_rwsize() gets called and server->rsize,
>> > server->wsize are 0
>> >     so they never get set to the sizes returned by the server.
>> > 
>> >     Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
>> >     Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
>> > 
>> > > Thanks,
>> > > NeilBrown
>> 
>> Thanks for the suggestion.
>> The kernel doesn't have that patch, but I don't think it is relevant.
>> The ->rsize does have a suitable value - it isn't zero.
>> The problem is that the session limit appears to change, and the
>> client
>> doesn't adjust to the change.
>> 
>> My current theory is that the client actually requested the change,
>> though on behalf of a different filesystem using the same session.
>> 
>
> So perhaps the right thing to do then, is to advertise a session max
> response/reply size of NFS_MAX_FILE_IO_SIZE +
> max(nfs41_maxread_overhead,nfs41_maxwrite_overhead) and just expect the
> server negotiate that value down if it needs to?

Agreed - and that is exactly what Linux has done since about 3.11.
My customer is still on 3.0 which advertises ->[wr]size, and this change
wasn't obvious from the change logs so I didn't find it during my
initial investigation.
I've provided a patch and hope to get feedback in about a week.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: NFSv4.1 session reset needs to update ->rsize and ->wsize - how???
  2018-09-05 21:12       ` NeilBrown
  2018-09-05 21:56         ` Trond Myklebust
@ 2018-09-06 17:03         ` Olga Kornievskaia
  1 sibling, 0 replies; 10+ messages in thread
From: Olga Kornievskaia @ 2018-09-06 17:03 UTC (permalink / raw)
  To: NeilBrown; +Cc: Trond Myklebust, linux-nfs

On Wed, Sep 5, 2018 at 5:12 PM NeilBrown <neilb@suse.com> wrote:
>
> On Wed, Sep 05 2018, Olga Kornievskaia wrote:
>
> > On Tue, Sep 4, 2018 at 8:04 PM NeilBrown <neilb@suse.com> wrote:
> >>
> >> On Tue, Sep 04 2018, Trond Myklebust wrote:
> >>
> >> > On Wed, 2018-09-05 at 08:47 +1000, NeilBrown wrote:
> >> >> With NFSv4.1, the server specifies max_rqst_sz and max_resp_sz in the
> >> >> reply to CREATE session.
> >> >>
> >> >> If the client finds it needs to call nfs4_reset_session(), it might
> >> >> get
> >> >> smaller sizes back, so any pending read/writes would need to be
> >> >> resized.
> >> >>
> >> >> However, I cannot see how the retry handling for reads/writes has any
> >> >> chance to change the size.  It looks like a request is broken up to
> >> >> match the original ->rsize and ->wsize, then those individual IO
> >> >> requests can be retried, but the higher level request is never
> >> >> re-evaluated in light of a new size.
> >> >>
> >> >> Am I missing something, or is this not supported at present?
> >> >> If it isn't supported, any suggestions on how best to handle a
> >> >> reduction of the rsize/wsize ??
> >> >>
> >> >
> >> > Why would a sane server want to do this?
> >>
> >> Why would a sane protocol support it? :-)
> >>
> >> I have a network trace of SLE11-SP4 (3.0 based) talking to "a NetApp
> >> appliance".
> >> It sends a 64K write and gets NFS4ERR_REQ_TOO_BIG.
> >> It then closes the file (getting NFS4ERR_SEQ_MISORDERED even though it
> >> used a seq number 1 more than the WRITE request), and then
> >> DESTROY_SESSION and CREATE_SESSION.
> >> The CREATE_SESSION gets "max req size" of 33812 and "max resp size" of
> >> 33672.
> >> It then opens the file again and retries the 64K write....
> >>
> >> I have a separate trace showing the initial mount where the sizes are 71680
> >> and 81920.
> >>
> >> I don't have a trace where it stops working, but reportedly writes work
> >> smoothly for some hours after a mount, but then suddenly stop working.
> >>
> >> The CREATE_SESSION *call* requests I see have the small (32K) sizes, but
> >> presumably they are the result of a previous CREATE_SESSION reply giving
> >> a small value.
> >>
> >> I just had a thought.
> >> If one session is shared by two "struct nfs_server" with different
> >> ->rsize or ->wsize, then the session might get set up with the smaller
> >> size, and the mount using the larger size will get confused.
> >> In 3.0 (and even 3.10) nfs4_init_session() limits the requested session
> >> parameters to ->rsize and ->wsize.
> >> That changed in 18aad3d552c7.
> >>
> >> Maybe I just need to remove that code from nfs4_init_session().
> >> I'll give it a try.
> >>
> >
> > Neil, does the code have this commit?
> >
> > commit 033853325fe3bdc70819a8b97915bd3bca41d3af
> > Author: Olga Kornievskaia <kolga@netapp.com>
> > Date:   Wed Mar 8 14:39:15 2017 -0500
> >
> >     NFSv4.1 respect server's max size in CREATE_SESSION
> >
> >     Currently client doesn't respect max sizes server returns in CREATE_SESSION.
> >     nfs4_session_set_rwsize() gets called and server->rsize, server->wsize are 0
> >     so they never get set to the sizes returned by the server.
> >
> >     Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> >     Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >
> >> Thanks,
> >> NeilBrown
>
> Thanks for the suggestion.
> The kernel doesn't have that patch, but I don't think it is relevant.
> The ->rsize does have a suitable value - it isn't zero.
> The problem is that the session limit appears to change, and the client
> doesn't adjust to the change.
>
> My current theory is that the client actually requested the change,
> though on behalf of a different filesystem using the same session.

I think the patch is relevant. I think what you described points to
the exact same problem the commit addresses.

Netapp server can return a size smaller than the client has requested.
Without that patch, the client will ignore what the server sent and
will use the value the client has sent. While the patch might not have
fixed it the 'correct' way (and the location of
nfs4_session_set_rwsize() should have been called at a different
place. It does seem to fix the problem (according to testing).

Netapp does not recommend changing  the rsize on the server side but
it is theoretically possible (and I know of customer who have used it)
and if some error flow ends up re-creating a session, without this
patch, you will see this problem because the client will send a higher
value then the server can support.

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

end of thread, other threads:[~2018-09-06 21:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-04 22:47 NFSv4.1 session reset needs to update ->rsize and ->wsize - how??? NeilBrown
2018-09-04 23:11 ` Trond Myklebust
2018-09-05  0:02   ` NeilBrown
2018-09-05 13:44     ` Olga Kornievskaia
2018-09-05 15:12       ` Trond Myklebust
2018-09-05 15:46         ` Olga Kornievskaia
2018-09-05 21:12       ` NeilBrown
2018-09-05 21:56         ` Trond Myklebust
2018-09-05 22:10           ` NeilBrown
2018-09-06 17:03         ` Olga Kornievskaia

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.