Skip to content

RFC nlm:Fix bug nlm cann't process retransmited request correctly

Mi Jinlong linux-nfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3sunrpc:add an universal DRC to sunrpcinclude/linux/sunrpc/drc.h net/sunrpc/Makefile net/sunrpc/drc.c+424 -10 replies
2/3nlm:add DRC to NLM using sunrpc's universal DRCfs/lockd/svc.c fs/lockd/svc4proc.c include/linux/lockd/lockd.h+99 -250 replies
3/3nfsd:modify the nfsd's DRC to use sunrpc's universal DRCarch/parisc/kernel/sys_parisc32.c arch/s390/kernel/compat_linux.c arch/sparc/kernel/sys_sparc32.c +13 more+30 -4170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 0/3] nlm:Fix bug nlm cann't process retransmited request correctly

I found a bug when tested NLM. The case likes followed:

client server
| |
step1 | open file |
open |------------------------------->|
| ok |
|<-------------------------------|
| | step2
| -> | <- service nfslock sto=
p

             |                                |
             | WL1: write lock request{0, 0}  |
      step3  |------------------------------->|
      fcntl  |                                |=20
             |                                |
             |    WL1_re: WL1 retransmit      |
             |------------------------------->|
             |                                |
             |       WL1.reply   ENOLCK       |
             |<-------------------------------|
             |                                |
             |                                | step4
             |                             -> | <- service nfslock star=
t
             |                                |
             | WL2: write lock request{0, 0}  |
      step5  |------------------------------->|
      fcntl  |                                |
             |        WL1_re.reply OK         |
             |<-------------------------------|
             |       WL2.reply EBLOCKD        |
             |<-------------------------------|

client can not acquire for write lock any more after step4.

Reason:
Server reply ENOLCK for WL1 to client because nfslock service stop=
ed, but it can not
distinguish retransmited request with normal request, so it reply O=
K for WL1_re to
client after nfslock service start. But fcntl client called will ret=
urn when it receive
WL1.reply, and WL2 can not get a equal svid to WL1_re=EF=BC=8Cso ser=
ver will reply EBLOCKD for
it.

Suggestion:

I suggest add an DRC for NLM.
There are three patchs followed:

1. add an universal DRC to sunrpc, it will be used by those protocol which be built on sunrpc [0001-Add-an-universal-DRC-to-sunrpc.patch]

2. add DRC to NLM using sunrpc's universal DRC

      [0002-Add-DRC-to-NLM-using-sunrpc-s-DRC.patch]

3. modify the nfsd's DRC to use sunrpc's universal DRC

      [0003-Modify-the-nfsd-s-DRC-to-use-sunrpc-s-universal-DRC.patch]

--

 arch/parisc/kernel/sys_parisc32.c |    2 +-
 arch/s390/kernel/compat_linux.c   |    2 +-
 arch/sparc/kernel/sys_sparc32.c   |    2 +-
 fs/lockd/svc.c                    |   66 ++++++++
 fs/lockd/svc4proc.c               |   52 +++---
 fs/nfsd/Makefile                  |    2 +-
 fs/nfsd/nfs2acl.c                 |    2 +-
 fs/nfsd/nfs3acl.c                 |    2 +-
 fs/nfsd/nfs3proc.c                |    2 +-
 fs/nfsd/nfs4proc.c                |    2 +-
 fs/nfsd/nfs4state.c               |    2 +-
 fs/nfsd/nfscache.c                |  330 -----------------------------=
--------
 fs/nfsd/nfsctl.c                  |   10 +-
 fs/nfsd/nfsproc.c                 |    2 +-
 fs/nfsd/nfssvc.c                  |   13 +-
 fs/nfsd/stats.c                   |    9 +-
 include/linux/lockd/lockd.h       |    6 +
 include/linux/nfsd/cache.h        |   62 -------
 include/linux/nfsd/stats.h        |    3 -
 include/linux/sunrpc/drc.h        |   97 +++++++++++
 net/sunrpc/Makefile               |    2 +-
 net/sunrpc/drc.c                  |  326 +++++++++++++++++++++++++++++=
+++++++
 22 files changed, 553 insertions(+), 443 deletions(-) =20

--=20
Regards
Mi Jinlong