Bug 263728

Summary: NFSv4.1/4.2 server erroneously always clears slot 0 for the callback session
Product: Base System Reporter: Rick Macklem <rmacklem>
Component: kernAssignee: Rick Macklem <rmacklem>
Status: Closed FIXED    
Severity: Affects Some People Flags: rmacklem: mfc-stable13+
rmacklem: mfc-stable12+
Priority: ---    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Fixes the NFSv4.1/4.2 to clear the correct callback session slot none

Description Rick Macklem freebsd_committer freebsd_triage 2022-05-02 14:38:21 UTC

    
Comment 1 Rick Macklem freebsd_committer freebsd_triage 2022-05-02 14:40:05 UTC
Created attachment 233671 [details]
Fixes the NFSv4.1/4.2 to clear the correct callback session slot

The NFSv4.1/4.2 server erroneously
always frees session slot zero for callbacks.  This only
affects 4.1/4.2 mounts if the server has delegations
enabled or is a pNFS configuration.  Even for those
cases, the effect is mainly to only use slot 0 for
callbacks, serializing all of them.  There is a slight
chance that callbacks will fail if the client performs
them in a different order than received on the TCP
connection.

This patch fixes the problem.  Found during a recent
IETF NFSv4 testing event.
Comment 2 Rick Macklem freebsd_committer freebsd_triage 2022-05-02 14:41:28 UTC
Note that this bug only affects client NFSv4.1/4.2 mounts
if the server has delegations enabled (not the default)
or is a pNFS configuration (very rare).
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-05-02 19:48:54 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=271f6d52a606e86c11b366082f11fe69350f24da

commit 271f6d52a606e86c11b366082f11fe69350f24da
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-05-02 19:45:42 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-05-02 19:47:43 +0000

    nfsd: Fix session slot freeing for NFSv4.1/4.2

    Without this patch the NFSv4.1/4.2 server erroneously
    always frees session slot zero for callbacks.  This only
    affects 4.1/4.2 mounts if the server has delegations
    enabled or is a pNFS configuration.  Even for those
    cases, the effect is mainly to only use slot 0 for
    callbacks, serializing all of them.  There is a slight
    chance that callbacks will fail if the client performs
    them in a different order than received on the TCP
    connection.

    If this bug affects your server, you will see console
    messages like:
      newnfs_request: Bad session slot

    This patch fixes the problem.  Found during a recent
    IETF NFSv4 testing event.

    PR:     263728
    MFC after:      2 weeks

 sys/fs/nfsserver/nfs_nfsdstate.c | 2 ++
 1 file changed, 2 insertions(+)
Comment 4 Rick Macklem freebsd_committer freebsd_triage 2022-05-02 20:02:59 UTC
Patch has been committed to main and will be MFC'd.

Also, note that, if your server is affected by this bug
you will see messages like:
  newnfs_request: Bad session slot
in your console logs.
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-05-16 19:22:51 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=a3821a906e42ad7b1886d1febbe63baa704d2029

commit a3821a906e42ad7b1886d1febbe63baa704d2029
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-05-02 19:45:42 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-05-16 19:21:06 +0000

    nfsd: Fix session slot freeing for NFSv4.1/4.2

    Without this patch the NFSv4.1/4.2 server erroneously
    always frees session slot zero for callbacks.  This only
    affects 4.1/4.2 mounts if the server has delegations
    enabled or is a pNFS configuration.  Even for those
    cases, the effect is mainly to only use slot 0 for
    callbacks, serializing all of them.  There is a slight
    chance that callbacks will fail if the client performs
    them in a different order than received on the TCP
    connection.

    If this bug affects your server, you will see console
    messages like:
      newnfs_request: Bad session slot

    This patch fixes the problem.  Found during a recent
    IETF NFSv4 testing event.

    PR:     263728

    (cherry picked from commit 271f6d52a606e86c11b366082f11fe69350f24da)

 sys/fs/nfsserver/nfs_nfsdstate.c | 2 ++
 1 file changed, 2 insertions(+)
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-05-16 19:27:52 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=81091a7ca11acd5adcc673ffd06f8e08791386ea

commit 81091a7ca11acd5adcc673ffd06f8e08791386ea
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-05-02 19:45:42 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-05-16 19:26:18 +0000

    nfsd: Fix session slot freeing for NFSv4.1/4.2

    Without this patch the NFSv4.1/4.2 server erroneously
    always frees session slot zero for callbacks.  This only
    affects 4.1/4.2 mounts if the server has delegations
    enabled or is a pNFS configuration.  Even for those
    cases, the effect is mainly to only use slot 0 for
    callbacks, serializing all of them.  There is a slight
    chance that callbacks will fail if the client performs
    them in a different order than received on the TCP
    connection.

    If this bug affects your server, you will see console
    messages like:
      newnfs_request: Bad session slot

    This patch fixes the problem.  Found during a recent
    IETF NFSv4 testing event.

    PR:     263728

    (cherry picked from commit 271f6d52a606e86c11b366082f11fe69350f24da)

 sys/fs/nfsserver/nfs_nfsdstate.c | 2 ++
 1 file changed, 2 insertions(+)
Comment 7 Rick Macklem freebsd_committer freebsd_triage 2022-05-16 19:43:56 UTC
Patch has been committed and MFC'd.