Skip to contentSkip to conversation

lockd: Regenerate NLMv4 XDR code

PATCH In review Chuck Lever 2 participants 2 messages Jun 30

Subsystems (2)
lore
Share & tools
lore

Chuck Lever

author maintainer
#0 lore raw

PATCH 1/1 lockd: Regenerate NLMv4 XDR code

The checked-in NLMv4 xdrgen output predates the addition of enum value validation to generated decoders. As a result the decoders for fsh4_mode, fsh4_access, and nlm4_stats still accept any 32-bit value, while the current generator rejects values outside the enumeration. Resync the generated files with the in-tree xdrgen by regenerating from the unchanged nlm4.x specification.

This is a plain regeneration with no specification change; it also refreshes the recorded specification modification time to show that all existing enum decoders have picked up the xdrgen tool fix.

---
 fs/lockd/nlm3xdr_gen.c               |  2 +-
 fs/lockd/nlm3xdr_gen.h               |  2 +-
 fs/lockd/nlm4xdr_gen.c               | 47 ++++++++++++++++++++++++++--
 fs/lockd/nlm4xdr_gen.h               |  2 +-
 fs/nfsd/nfs4xdr_gen.c                |  2 +-
 fs/nfsd/nfs4xdr_gen.h                |  2 +-
 include/linux/sunrpc/xdrgen/nfs4_1.h |  2 +-
 include/linux/sunrpc/xdrgen/nlm3.h   |  2 +-
 include/linux/sunrpc/xdrgen/nlm4.h   |  2 +-
 9 files changed, 53 insertions(+), 10 deletions(-)
fs/lockd/nlm3xdr_gen.c +1 -1
index 9ed5a41b5daf..352a694ca0f5 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 // Generated by xdrgen. Manual edits will be lost.
 // XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x
-// XDR specification modification time: Thu Apr 23 10:56:34 2026
+// XDR specification modification time: Mon Jun 29 20:39:34 2026
 
 #include <linux/sunrpc/svc.h>
 
fs/lockd/nlm3xdr_gen.h +1 -1
index c99038e99805..d24cbb887b7f 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x */
-/* XDR specification modification time: Thu Apr 23 10:56:34 2026 */
+/* XDR specification modification time: Mon Jun 29 20:39:34 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM3_DECL_H
 #define _LINUX_XDRGEN_NLM3_DECL_H
fs/lockd/nlm4xdr_gen.c +45 -2

71 lines not on this page · raw message

fs/lockd/nlm4xdr_gen.h +1 -1
index b6008b296a3e..b5898f0e0689 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm4.x */
-/* XDR specification modification time: Thu Dec 25 13:10:19 2025 */
+/* XDR specification modification time: Mon Jun 29 20:39:36 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM4_DECL_H
 #define _LINUX_XDRGEN_NLM4_DECL_H
fs/nfsd/nfs4xdr_gen.c +1 -1
index a6725c773768..e5a6ea4a9349 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 // Generated by xdrgen. Manual edits will be lost.
 // XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x
-// XDR specification modification time: Wed Mar 25 11:40:02 2026
+// XDR specification modification time: Tue Jun 30 11:56:05 2026
 
 #include <linux/sunrpc/svc.h>
 
fs/nfsd/nfs4xdr_gen.h +1 -1
index f6a458a07406..4092379a9efa 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */
-/* XDR specification modification time: Wed Mar 25 11:40:02 2026 */
+/* XDR specification modification time: Tue Jun 30 11:56:05 2026 */
 
 #ifndef _LINUX_XDRGEN_NFS4_1_DECL_H
 #define _LINUX_XDRGEN_NFS4_1_DECL_H
include/linux/sunrpc/xdrgen/nfs4_1.h +1 -1
index 356c3da9f4e0..6ff4d727b0d2 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */
-/* XDR specification modification time: Wed Mar 25 11:40:02 2026 */
+/* XDR specification modification time: Tue Jun 30 11:56:05 2026 */
 
 #ifndef _LINUX_XDRGEN_NFS4_1_DEF_H
 #define _LINUX_XDRGEN_NFS4_1_DEF_H
include/linux/sunrpc/xdrgen/nlm3.h +1 -1
index 897e7d91807c..3cc69a09c1c7 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x */
-/* XDR specification modification time: Thu Apr 23 10:56:34 2026 */
+/* XDR specification modification time: Mon Jun 29 20:39:34 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM3_DEF_H
 #define _LINUX_XDRGEN_NLM3_DEF_H
include/linux/sunrpc/xdrgen/nlm4.h +1 -1
index e95e8f105624..7b6f10ea2838 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm4.x */
-/* XDR specification modification time: Thu Dec 25 13:10:19 2025 */
+/* XDR specification modification time: Mon Jun 29 20:39:36 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM4_DEF_H
 #define _LINUX_XDRGEN_NLM4_DEF_H
Signature · 1 line
2.54.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 199 lines · Chuck Lever

The checked-in NLMv4 xdrgen output predates the addition of enum value validation to generated decoders. As a result the decoders for fsh4_mode, fsh4_access, and nlm4_stats still accept any 32-bit value, while the current generator rejects values outside the enumeration. Resync the generated files with the in-tree xdrgen by regenerating from the unchanged nlm4.x specification.

This is a plain regeneration with no specification change; it also refreshes the recorded specification modification time to show that all existing enum decoders have picked up the xdrgen tool fix.

---
 fs/lockd/nlm3xdr_gen.c               |  2 +-
 fs/lockd/nlm3xdr_gen.h               |  2 +-
 fs/lockd/nlm4xdr_gen.c               | 47 ++++++++++++++++++++++++++--
 fs/lockd/nlm4xdr_gen.h               |  2 +-
 fs/nfsd/nfs4xdr_gen.c                |  2 +-
 fs/nfsd/nfs4xdr_gen.h                |  2 +-
 include/linux/sunrpc/xdrgen/nfs4_1.h |  2 +-
 include/linux/sunrpc/xdrgen/nlm3.h   |  2 +-
 include/linux/sunrpc/xdrgen/nlm4.h   |  2 +-
 9 files changed, 53 insertions(+), 10 deletions(-)
fs/lockd/nlm3xdr_gen.c +1 -1
index 9ed5a41b5daf..352a694ca0f5 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 // Generated by xdrgen. Manual edits will be lost.
 // XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x
-// XDR specification modification time: Thu Apr 23 10:56:34 2026
+// XDR specification modification time: Mon Jun 29 20:39:34 2026
 
 #include <linux/sunrpc/svc.h>
 
fs/lockd/nlm3xdr_gen.h +1 -1
index c99038e99805..d24cbb887b7f 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x */
-/* XDR specification modification time: Thu Apr 23 10:56:34 2026 */
+/* XDR specification modification time: Mon Jun 29 20:39:34 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM3_DECL_H
 #define _LINUX_XDRGEN_NLM3_DECL_H
fs/lockd/nlm4xdr_gen.c +45 -2
index 1c8c221db456..004ea01c689e 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 // Generated by xdrgen. Manual edits will be lost.
 // XDR specification file: ../../Documentation/sunrpc/xdr/nlm4.x
-// XDR specification modification time: Thu Dec 25 13:10:19 2025
+// XDR specification modification time: Mon Jun 29 20:39:36 2026
 
 #include <linux/sunrpc/svc.h>
 
@@ -20,6 +20,16 @@ xdrgen_decode_fsh4_mode(struct xdr_stream *xdr, fsh4_mode *ptr)
 
 	if (xdr_stream_decode_u32(xdr, &val) < 0)
 		return false;
+	/* Compiler may optimize to a range check for dense enums */
+	switch (val) {
+	case fsm_DN:
+	case fsm_DR:
+	case fsm_DW:
+	case fsm_DRW:
+		break;
+	default:
+		return false;
+	}
 	*ptr = val;
 	return true;
 }
@@ -31,6 +41,16 @@ xdrgen_decode_fsh4_access(struct xdr_stream *xdr, fsh4_access *ptr)
 
 	if (xdr_stream_decode_u32(xdr, &val) < 0)
 		return false;
+	/* Compiler may optimize to a range check for dense enums */
+	switch (val) {
+	case fsa_NONE:
+	case fsa_R:
+	case fsa_W:
+	case fsa_RW:
+		break;
+	default:
+		return false;
+	}
 	*ptr = val;
 	return true;
 }
@@ -62,7 +82,30 @@ xdrgen_decode_int32(struct xdr_stream *xdr, int32 *ptr)
 static bool __maybe_unused
 xdrgen_decode_nlm4_stats(struct xdr_stream *xdr, nlm4_stats *ptr)
 {
-	return xdr_stream_decode_be32(xdr, ptr) == 0;
+	__be32 raw;
+	u32 val;
+
+	if (xdr_stream_decode_be32(xdr, &raw) < 0)
+		return false;
+	val = be32_to_cpu(raw);
+	/* Compiler may optimize to a range check for dense enums */
+	switch (val) {
+	case NLM4_GRANTED:
+	case NLM4_DENIED:
+	case NLM4_DENIED_NOLOCKS:
+	case NLM4_BLOCKED:
+	case NLM4_DENIED_GRACE_PERIOD:
+	case NLM4_DEADLCK:
+	case NLM4_ROFS:
+	case NLM4_STALE_FH:
+	case NLM4_FBIG:
+	case NLM4_FAILED:
+		break;
+	default:
+		return false;
+	}
+	*ptr = raw;
+	return true;
 }
 
 static bool __maybe_unused
fs/lockd/nlm4xdr_gen.h +1 -1
index b6008b296a3e..b5898f0e0689 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm4.x */
-/* XDR specification modification time: Thu Dec 25 13:10:19 2025 */
+/* XDR specification modification time: Mon Jun 29 20:39:36 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM4_DECL_H
 #define _LINUX_XDRGEN_NLM4_DECL_H
fs/nfsd/nfs4xdr_gen.c +1 -1
index a6725c773768..e5a6ea4a9349 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 // Generated by xdrgen. Manual edits will be lost.
 // XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x
-// XDR specification modification time: Wed Mar 25 11:40:02 2026
+// XDR specification modification time: Tue Jun 30 11:56:05 2026
 
 #include <linux/sunrpc/svc.h>
 
fs/nfsd/nfs4xdr_gen.h +1 -1
index f6a458a07406..4092379a9efa 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */
-/* XDR specification modification time: Wed Mar 25 11:40:02 2026 */
+/* XDR specification modification time: Tue Jun 30 11:56:05 2026 */
 
 #ifndef _LINUX_XDRGEN_NFS4_1_DECL_H
 #define _LINUX_XDRGEN_NFS4_1_DECL_H
include/linux/sunrpc/xdrgen/nfs4_1.h +1 -1
index 356c3da9f4e0..6ff4d727b0d2 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */
-/* XDR specification modification time: Wed Mar 25 11:40:02 2026 */
+/* XDR specification modification time: Tue Jun 30 11:56:05 2026 */
 
 #ifndef _LINUX_XDRGEN_NFS4_1_DEF_H
 #define _LINUX_XDRGEN_NFS4_1_DEF_H
include/linux/sunrpc/xdrgen/nlm3.h +1 -1
index 897e7d91807c..3cc69a09c1c7 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm3.x */
-/* XDR specification modification time: Thu Apr 23 10:56:34 2026 */
+/* XDR specification modification time: Mon Jun 29 20:39:34 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM3_DEF_H
 #define _LINUX_XDRGEN_NLM3_DEF_H
include/linux/sunrpc/xdrgen/nlm4.h +0 -0
index e95e8f105624..7b6f10ea2838 100644

include/linux/sunrpc/xdrgen/nlm4.h line 7

Quoted 8 lines
include/linux/sunrpc/xdrgen/nlm4.h +1 -1
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Generated by xdrgen. Manual edits will be lost. */
 /* XDR specification file: ../../Documentation/sunrpc/xdr/nlm4.x */
-/* XDR specification modification time: Thu Dec 25 13:10:19 2025 */
+/* XDR specification modification time: Mon Jun 29 20:39:36 2026 */
 
 #ifndef _LINUX_XDRGEN_NLM4_DEF_H
 #define _LINUX_XDRGEN_NLM4_DEF_H