Skip to contentSkip to conversation

nfsd: don't set SVC_SOCK_ANONYMOUS when creating nfsd sockets

PATCH In review Jeff Layton 3 participants 5 messages Jul 19, 2024 – Jul 22, 2024

Subsystems (2)
lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

PATCH 1/1 nfsd: don't set SVC_SOCK_ANONYMOUS when creating nfsd sockets

When creating nfsd sockets via the netlink interface, we do want to register with the portmapper. Don't set SVC_SOCK_ANONYMOUS.

Fixes 16a471177496 NFSD: add listener-{set,get} netlink command
Cc Lorenzo Bianconi <[email protected]>
---
 fs/nfsd/nfsctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfsctl.c +1 -2
index 9e0ea6fc2aa3..34eb2c2cbcde 100644
@@ -2069,8 +2069,7 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)
 			continue;
 		}
 
-		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa,
-					      SVC_SOCK_ANONYMOUS,
+		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa, 0,
 					      get_current_cred());
 		/* always save the latest error */
 		if (ret < 0)

---
base-commit: 769d20028f45a4f442cfe558a32faba357a7f5e2
change-id: 20240719-nfsd-next-d9582a2c50c2

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
#1 lore raw
Quoted 2 lines · Jeff Layton

When creating nfsd sockets via the netlink interface, we do want to register with the portmapper. Don't set SVC_SOCK_ANONYMOUS.

NFSD's RDMA transports don't register with rpcbind, for example.

Quoted 31 lines
Fixes 16a471177496 NFSD: add listener-{set,get} netlink command
Cc Lorenzo Bianconi <[email protected]>
---
 fs/nfsd/nfsctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfsctl.c +1 -3
index 9e0ea6fc2aa3..34eb2c2cbcde 100644
@@ -2069,8 +2069,7 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)
 			continue;
 		}
 
-		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa,
-					      SVC_SOCK_ANONYMOUS,
+		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa, 0,
 					      get_current_cred());
 		/* always save the latest error */
 		if (ret < 0)
 
---

base-commit: 769d20028f45a4f442cfe558a32faba357a7f5e2
change-id: 20240719-nfsd-next-d9582a2c50c2

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Chuck Lever
#2 lore raw
Quoted 5 lines · Chuck Lever
Quoted 2 lines · Jeff Layton

When creating nfsd sockets via the netlink interface, we do want to register with the portmapper. Don't set SVC_SOCK_ANONYMOUS.

NFSD's RDMA transports don't register with rpcbind, for example.

For RDMA, what does inet->sk_family and in->sk_protocol contain in svc_setup_socket()?

Could that code detect that it doesn't make sense to register the socket with rpcbind?

NeilBrown

author maintainer
#3 lore raw
In reply to Chuck Lever
Quoted 6 lines · Chuck Lever
Quoted 2 lines · Jeff Layton

When creating nfsd sockets via the netlink interface, we do want to register with the portmapper. Don't set SVC_SOCK_ANONYMOUS.

NFSD's RDMA transports don't register with rpcbind, for example.

They still aren't registered with this patch either. After doing nfsdctl autostart:

[kdevops@kdevops-nfsd ~]$ rpcinfo -p

   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  42104  status
    100024    1   tcp  40159  status
    100003    3   udp   2049  nfs
    100227    3   udp   2049  nfs_acl
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    3   tcp   2049  nfs_acl
    100021    1   udp  46387  nlockmgr
    100021    3   udp  46387  nlockmgr
    100021    4   udp  46387  nlockmgr
    100021    1   tcp  36565  nlockmgr
    100021    3   tcp  36565  nlockmgr
    100021    4   tcp  36565  nlockmgr

I don't see a need to do anything else here.

Quoted 33 lines
Quoted 32 lines
Fixes 16a471177496 NFSD: add listener-{set,get} netlink command
Cc Lorenzo Bianconi <[email protected]>
---
 fs/nfsd/nfsctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfsctl.c +1 -3
index 9e0ea6fc2aa3..34eb2c2cbcde 100644
@@ -2069,8 +2069,7 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)
 			continue;
 		}
 
-		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa,
-					      SVC_SOCK_ANONYMOUS,
+		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa, 0,
 					      get_current_cred());
 		/* always save the latest error */
 		if (ret < 0)
 
---

base-commit: 769d20028f45a4f442cfe558a32faba357a7f5e2
change-id: 20240719-nfsd-next-d9582a2c50c2

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Jeff Layton <[email protected]>
#4 lore raw
Quoted 33 lines · Jeff Layton
Quoted 6 lines · Chuck Lever
Quoted 2 lines · Jeff Layton

When creating nfsd sockets via the netlink interface, we do want to register with the portmapper. Don't set SVC_SOCK_ANONYMOUS.

NFSD's RDMA transports don't register with rpcbind, for example.

They still aren't registered with this patch either. After doing nfsdctl autostart:

[kdevops@kdevops-nfsd ~]$ rpcinfo -p

   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  42104  status
    100024    1   tcp  40159  status
    100003    3   udp   2049  nfs
    100227    3   udp   2049  nfs_acl
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    3   tcp   2049  nfs_acl
    100021    1   udp  46387  nlockmgr
    100021    3   udp  46387  nlockmgr
    100021    4   udp  46387  nlockmgr
    100021    1   tcp  36565  nlockmgr
    100021    3   tcp  36565  nlockmgr
    100021    4   tcp  36565  nlockmgr
Quoted 1 line

I don't see a need to do anything else here.

Fair enough. Applied to nfsd-fixes (for v6.11-rc).

Not registering RDMA transports with rpcbind was done to mimic Solaris behavior, IIRC. I don't remember any functional reason not to register them.

Quoted 35 lines
Quoted 32 lines
Quoted 31 lines
Fixes 16a471177496 NFSD: add listener-{set,get} netlink command
Cc Lorenzo Bianconi <[email protected]>
---
 fs/nfsd/nfsctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfsctl.c +1 -3
index 9e0ea6fc2aa3..34eb2c2cbcde 100644
@@ -2069,8 +2069,7 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)
 			continue;
 		}
 
-		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa,
-					      SVC_SOCK_ANONYMOUS,
+		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa, 0,
 					      get_current_cred());
 		/* always save the latest error */
 		if (ret < 0)
 
---

base-commit: 769d20028f45a4f442cfe558a32faba357a7f5e2
change-id: 20240719-nfsd-next-d9582a2c50c2

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Chuck Lever