Skip to content

Commit 80ec805

Browse files
committed
NFSD: Put cache get-reqs dump attrs under reply
The new get-reqs dump operations added to sunrpc_cache.yaml and nfsd.yaml place the "requests" nested attribute under dump.request. A netlink dump carries an empty request; its payload travels back in the reply. Because the spec names no reply attributes, the YNL C code generator synthesizes a forward reference to a <op>_rsp struct that is never defined, breaking any consumer of these specs. This first surfaced when Thorsten Leemhuis built tools/net/ynl against -next: nfsd-user.h:746: error: field 'obj' has incomplete type struct nfsd_svc_export_get_reqs_rsp obj ... nfsd-user.h:826: error: field 'obj' has incomplete type struct nfsd_expkey_get_reqs_rsp obj ... nfsd-user.c:1211: error: 'nfsd_svc_export_get_reqs_rsp_parse' undeclared sunrpc_cache.yaml has the same defect in ip-map-get-reqs and unix-gid-get-reqs, but nfsd.yaml errors out first in the Makefile's alphabetical build order and hides the sunrpc failures. These bugs were introduced by incorrect merge conflict resolution. Reported-by: Thorsten Leemhuis <linux@leemhuis.info> Closes: https://lore.kernel.org/linux-nfs/f6a3ca6d-e5cb-4a5c-9af2-8d2b1ce33ef0@leemhuis.info/ Fixes: 1045ccf519ce30 ("sunrpc: add netlink upcall for the auth.unix.ip cache") Tested-by: Thorsten Leemhuis <linux@leemhuis.info> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 70b7e35 commit 80ec805

4 files changed

Lines changed: 16 additions & 44 deletions

File tree

Documentation/netlink/specs/nfsd.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ operations:
416416
attribute-set: svc-export-reqs
417417
flags: [admin-perm]
418418
dump:
419-
request:
419+
reply:
420420
attributes:
421421
- requests
422422
-
@@ -434,7 +434,7 @@ operations:
434434
attribute-set: expkey-reqs
435435
flags: [admin-perm]
436436
dump:
437-
request:
437+
reply:
438438
attributes:
439439
- requests
440440
-

Documentation/netlink/specs/sunrpc_cache.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ operations:
101101
attribute-set: ip-map-reqs
102102
flags: [admin-perm]
103103
dump:
104-
request:
104+
reply:
105105
attributes:
106106
- requests
107107
-
@@ -119,7 +119,7 @@ operations:
119119
attribute-set: unix-gid-reqs
120120
flags: [admin-perm]
121121
dump:
122-
request:
122+
reply:
123123
attributes:
124124
- requests
125125
-

fs/nfsd/netlink.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,11 @@ static const struct nla_policy nfsd_pool_mode_set_nl_policy[NFSD_A_POOL_MODE_MOD
8888
[NFSD_A_POOL_MODE_MODE] = { .type = NLA_NUL_STRING, },
8989
};
9090

91-
/* NFSD_CMD_SVC_EXPORT_GET_REQS - dump */
92-
static const struct nla_policy nfsd_svc_export_get_reqs_nl_policy[NFSD_A_SVC_EXPORT_REQS_REQUESTS + 1] = {
93-
[NFSD_A_SVC_EXPORT_REQS_REQUESTS] = NLA_POLICY_NESTED(nfsd_svc_export_nl_policy),
94-
};
95-
9691
/* NFSD_CMD_SVC_EXPORT_SET_REQS - do */
9792
static const struct nla_policy nfsd_svc_export_set_reqs_nl_policy[NFSD_A_SVC_EXPORT_REQS_REQUESTS + 1] = {
9893
[NFSD_A_SVC_EXPORT_REQS_REQUESTS] = NLA_POLICY_NESTED(nfsd_svc_export_nl_policy),
9994
};
10095

101-
/* NFSD_CMD_EXPKEY_GET_REQS - dump */
102-
static const struct nla_policy nfsd_expkey_get_reqs_nl_policy[NFSD_A_EXPKEY_REQS_REQUESTS + 1] = {
103-
[NFSD_A_EXPKEY_REQS_REQUESTS] = NLA_POLICY_NESTED(nfsd_expkey_nl_policy),
104-
};
105-
10696
/* NFSD_CMD_EXPKEY_SET_REQS - do */
10797
static const struct nla_policy nfsd_expkey_set_reqs_nl_policy[NFSD_A_EXPKEY_REQS_REQUESTS + 1] = {
10898
[NFSD_A_EXPKEY_REQS_REQUESTS] = NLA_POLICY_NESTED(nfsd_expkey_nl_policy),
@@ -169,11 +159,9 @@ static const struct genl_split_ops nfsd_nl_ops[] = {
169159
.flags = GENL_CMD_CAP_DO,
170160
},
171161
{
172-
.cmd = NFSD_CMD_SVC_EXPORT_GET_REQS,
173-
.dumpit = nfsd_nl_svc_export_get_reqs_dumpit,
174-
.policy = nfsd_svc_export_get_reqs_nl_policy,
175-
.maxattr = NFSD_A_SVC_EXPORT_REQS_REQUESTS,
176-
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
162+
.cmd = NFSD_CMD_SVC_EXPORT_GET_REQS,
163+
.dumpit = nfsd_nl_svc_export_get_reqs_dumpit,
164+
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
177165
},
178166
{
179167
.cmd = NFSD_CMD_SVC_EXPORT_SET_REQS,
@@ -183,11 +171,9 @@ static const struct genl_split_ops nfsd_nl_ops[] = {
183171
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
184172
},
185173
{
186-
.cmd = NFSD_CMD_EXPKEY_GET_REQS,
187-
.dumpit = nfsd_nl_expkey_get_reqs_dumpit,
188-
.policy = nfsd_expkey_get_reqs_nl_policy,
189-
.maxattr = NFSD_A_EXPKEY_REQS_REQUESTS,
190-
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
174+
.cmd = NFSD_CMD_EXPKEY_GET_REQS,
175+
.dumpit = nfsd_nl_expkey_get_reqs_dumpit,
176+
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
191177
},
192178
{
193179
.cmd = NFSD_CMD_EXPKEY_SET_REQS,

net/sunrpc/netlink.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,11 @@ const struct nla_policy sunrpc_unix_gid_nl_policy[SUNRPC_A_UNIX_GID_EXPIRY + 1]
2929
[SUNRPC_A_UNIX_GID_EXPIRY] = { .type = NLA_U64, },
3030
};
3131

32-
/* SUNRPC_CMD_IP_MAP_GET_REQS - dump */
33-
static const struct nla_policy sunrpc_ip_map_get_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = {
34-
[SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy),
35-
};
36-
3732
/* SUNRPC_CMD_IP_MAP_SET_REQS - do */
3833
static const struct nla_policy sunrpc_ip_map_set_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = {
3934
[SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy),
4035
};
4136

42-
/* SUNRPC_CMD_UNIX_GID_GET_REQS - dump */
43-
static const struct nla_policy sunrpc_unix_gid_get_reqs_nl_policy[SUNRPC_A_UNIX_GID_REQS_REQUESTS + 1] = {
44-
[SUNRPC_A_UNIX_GID_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_unix_gid_nl_policy),
45-
};
46-
4737
/* SUNRPC_CMD_UNIX_GID_SET_REQS - do */
4838
static const struct nla_policy sunrpc_unix_gid_set_reqs_nl_policy[SUNRPC_A_UNIX_GID_REQS_REQUESTS + 1] = {
4939
[SUNRPC_A_UNIX_GID_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_unix_gid_nl_policy),
@@ -57,11 +47,9 @@ static const struct nla_policy sunrpc_cache_flush_nl_policy[SUNRPC_A_CACHE_FLUSH
5747
/* Ops table for sunrpc */
5848
static const struct genl_split_ops sunrpc_nl_ops[] = {
5949
{
60-
.cmd = SUNRPC_CMD_IP_MAP_GET_REQS,
61-
.dumpit = sunrpc_nl_ip_map_get_reqs_dumpit,
62-
.policy = sunrpc_ip_map_get_reqs_nl_policy,
63-
.maxattr = SUNRPC_A_IP_MAP_REQS_REQUESTS,
64-
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
50+
.cmd = SUNRPC_CMD_IP_MAP_GET_REQS,
51+
.dumpit = sunrpc_nl_ip_map_get_reqs_dumpit,
52+
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
6553
},
6654
{
6755
.cmd = SUNRPC_CMD_IP_MAP_SET_REQS,
@@ -71,11 +59,9 @@ static const struct genl_split_ops sunrpc_nl_ops[] = {
7159
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
7260
},
7361
{
74-
.cmd = SUNRPC_CMD_UNIX_GID_GET_REQS,
75-
.dumpit = sunrpc_nl_unix_gid_get_reqs_dumpit,
76-
.policy = sunrpc_unix_gid_get_reqs_nl_policy,
77-
.maxattr = SUNRPC_A_UNIX_GID_REQS_REQUESTS,
78-
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
62+
.cmd = SUNRPC_CMD_UNIX_GID_GET_REQS,
63+
.dumpit = sunrpc_nl_unix_gid_get_reqs_dumpit,
64+
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
7965
},
8066
{
8167
.cmd = SUNRPC_CMD_UNIX_GID_SET_REQS,

0 commit comments

Comments
 (0)