diff mbox series

lockd: Fix comment about NLMv3 backwards compatibility

Message ID 20240912225320.24178-1-pali@kernel.org (mailing list archive)
State New
Headers show
Series lockd: Fix comment about NLMv3 backwards compatibility | expand

Commit Message

Pali Rohár Sept. 12, 2024, 10:53 p.m. UTC
NLMv2 is completely different protocol than NLMv1 and NLMv3, and in
original Sun implementation is used for RPC loopback callbacks from statd
to lockd services. Linux does not use nor does not implement NLMv2.

Hence, NLMv3 is not backward compatible with NLMv2. But NLMv3 is backward
compatible with NLMv1. Fix comment.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 fs/lockd/clntxdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

NeilBrown Sept. 12, 2024, 11:10 p.m. UTC | #1
On Fri, 13 Sep 2024, Pali Rohár wrote:
> NLMv2 is completely different protocol than NLMv1 and NLMv3, and in
> original Sun implementation is used for RPC loopback callbacks from statd
> to lockd services. Linux does not use nor does not implement NLMv2.
> 
> Hence, NLMv3 is not backward compatible with NLMv2. But NLMv3 is backward
> compatible with NLMv1. Fix comment.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  fs/lockd/clntxdr.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
> index a3e97278b997..81ffa521f945 100644
> --- a/fs/lockd/clntxdr.c
> +++ b/fs/lockd/clntxdr.c
> @@ -3,7 +3,9 @@
>   * linux/fs/lockd/clntxdr.c
>   *
>   * XDR functions to encode/decode NLM version 3 RPC arguments and results.
> - * NLM version 3 is backwards compatible with NLM versions 1 and 2.
> + * NLM version 3 is backwards compatible with NLM version 1.
> + * NLM version 2 is different protocol used only for RPC loopback callbacks
> + * from statd to lockd and is not implemented on Linux.
>   *
>   * NLM client-side only.
>   *

Reviewed-by: NeilBrown <neilb@suse.de>

Do you have a reference for that info about v2?  I hadn't heard of it
before.

NeilBrown
Pali Rohár Sept. 12, 2024, 11:22 p.m. UTC | #2
On Friday 13 September 2024 09:10:45 NeilBrown wrote:
> On Fri, 13 Sep 2024, Pali Rohár wrote:
> > NLMv2 is completely different protocol than NLMv1 and NLMv3, and in
> > original Sun implementation is used for RPC loopback callbacks from statd
> > to lockd services. Linux does not use nor does not implement NLMv2.
> > 
> > Hence, NLMv3 is not backward compatible with NLMv2. But NLMv3 is backward
> > compatible with NLMv1. Fix comment.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> >  fs/lockd/clntxdr.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
> > index a3e97278b997..81ffa521f945 100644
> > --- a/fs/lockd/clntxdr.c
> > +++ b/fs/lockd/clntxdr.c
> > @@ -3,7 +3,9 @@
> >   * linux/fs/lockd/clntxdr.c
> >   *
> >   * XDR functions to encode/decode NLM version 3 RPC arguments and results.
> > - * NLM version 3 is backwards compatible with NLM versions 1 and 2.
> > + * NLM version 3 is backwards compatible with NLM version 1.
> > + * NLM version 2 is different protocol used only for RPC loopback callbacks
> > + * from statd to lockd and is not implemented on Linux.
> >   *
> >   * NLM client-side only.
> >   *
> 
> Reviewed-by: NeilBrown <neilb@suse.de>
> 
> Do you have a reference for that info about v2?  I hadn't heard of it
> before.
> 
> NeilBrown

I have just this information in my notes. I guess it should be possible
to gather more information about v2 from released Sun/Solaris source
code via OpenSolaris / Illumos projects.
Pali Rohár Sept. 12, 2024, 11:28 p.m. UTC | #3
On Friday 13 September 2024 01:22:07 Pali Rohár wrote:
> On Friday 13 September 2024 09:10:45 NeilBrown wrote:
> > On Fri, 13 Sep 2024, Pali Rohár wrote:
> > > NLMv2 is completely different protocol than NLMv1 and NLMv3, and in
> > > original Sun implementation is used for RPC loopback callbacks from statd
> > > to lockd services. Linux does not use nor does not implement NLMv2.
> > > 
> > > Hence, NLMv3 is not backward compatible with NLMv2. But NLMv3 is backward
> > > compatible with NLMv1. Fix comment.
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > ---
> > >  fs/lockd/clntxdr.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
> > > index a3e97278b997..81ffa521f945 100644
> > > --- a/fs/lockd/clntxdr.c
> > > +++ b/fs/lockd/clntxdr.c
> > > @@ -3,7 +3,9 @@
> > >   * linux/fs/lockd/clntxdr.c
> > >   *
> > >   * XDR functions to encode/decode NLM version 3 RPC arguments and results.
> > > - * NLM version 3 is backwards compatible with NLM versions 1 and 2.
> > > + * NLM version 3 is backwards compatible with NLM version 1.
> > > + * NLM version 2 is different protocol used only for RPC loopback callbacks
> > > + * from statd to lockd and is not implemented on Linux.
> > >   *
> > >   * NLM client-side only.
> > >   *
> > 
> > Reviewed-by: NeilBrown <neilb@suse.de>
> > 
> > Do you have a reference for that info about v2?  I hadn't heard of it
> > before.
> > 
> > NeilBrown
> 
> I have just this information in my notes. I guess it should be possible
> to gather more information about v2 from released Sun/Solaris source
> code via OpenSolaris / Illumos projects.

Just very quickly I found this Illumos XDR file for NLM:
https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/rpcsvc/nlm_prot.x

And it defines NLMv2 with two procedures numbered 17 and 18, plus there
is a comment in file header about v2.

So probably the best reference would be the Illumos source code.
Chuck Lever III Sept. 12, 2024, 11:34 p.m. UTC | #4
On Fri, Sep 13, 2024 at 01:28:20AM +0200, Pali Rohár wrote:
> On Friday 13 September 2024 01:22:07 Pali Rohár wrote:
> > On Friday 13 September 2024 09:10:45 NeilBrown wrote:
> > > On Fri, 13 Sep 2024, Pali Rohár wrote:
> > > > NLMv2 is completely different protocol than NLMv1 and NLMv3, and in
> > > > original Sun implementation is used for RPC loopback callbacks from statd
> > > > to lockd services. Linux does not use nor does not implement NLMv2.
> > > > 
> > > > Hence, NLMv3 is not backward compatible with NLMv2. But NLMv3 is backward
> > > > compatible with NLMv1. Fix comment.
> > > > 
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > ---
> > > >  fs/lockd/clntxdr.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
> > > > index a3e97278b997..81ffa521f945 100644
> > > > --- a/fs/lockd/clntxdr.c
> > > > +++ b/fs/lockd/clntxdr.c
> > > > @@ -3,7 +3,9 @@
> > > >   * linux/fs/lockd/clntxdr.c
> > > >   *
> > > >   * XDR functions to encode/decode NLM version 3 RPC arguments and results.
> > > > - * NLM version 3 is backwards compatible with NLM versions 1 and 2.
> > > > + * NLM version 3 is backwards compatible with NLM version 1.
> > > > + * NLM version 2 is different protocol used only for RPC loopback callbacks
> > > > + * from statd to lockd and is not implemented on Linux.
> > > >   *
> > > >   * NLM client-side only.
> > > >   *
> > > 
> > > Reviewed-by: NeilBrown <neilb@suse.de>
> > > 
> > > Do you have a reference for that info about v2?  I hadn't heard of it
> > > before.
> > > 
> > > NeilBrown
> > 
> > I have just this information in my notes. I guess it should be possible
> > to gather more information about v2 from released Sun/Solaris source
> > code via OpenSolaris / Illumos projects.
> 
> Just very quickly I found this Illumos XDR file for NLM:
> https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/rpcsvc/nlm_prot.x
> 
> And it defines NLMv2 with two procedures numbered 17 and 18, plus there
> is a comment in file header about v2.
> 
> So probably the best reference would be the Illumos source code.

What you see in the Illumos code is not something that is part
of the standard NLM protocol, but rather a private upcall protocol
between the kernel and user space that is special sauce added
by each implementation of NLM/NSM.

Also note the way NLMv3 is defined in this file: it defines only
a handful of new operations. The other operations are inherited
from NLMv1.

IMO the comment is accurate and does not warrant a change.
diff mbox series

Patch

diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index a3e97278b997..81ffa521f945 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -3,7 +3,9 @@ 
  * linux/fs/lockd/clntxdr.c
  *
  * XDR functions to encode/decode NLM version 3 RPC arguments and results.
- * NLM version 3 is backwards compatible with NLM versions 1 and 2.
+ * NLM version 3 is backwards compatible with NLM version 1.
+ * NLM version 2 is different protocol used only for RPC loopback callbacks
+ * from statd to lockd and is not implemented on Linux.
  *
  * NLM client-side only.
  *