nfsd: unregister with rpcbind when removing listener
Subsystems (2)
Olga Kornievskaia
reviewerPATCH 1/1 nfsd: unregister with rpcbind when removing listener
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfsd/nfsctl.c +4 -1
@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. */ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {
Signature · 1 line
2.47.1
Quoted 10 lines · Olga Kornievskaia
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
Removing all rpcbind registrations and then re-adding them might cause an outage for clients that attempt to mount the server right at that moment.
Quoted 23 lines
Fixes d093c9089260 ("nfsd: fix management of listener transports")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +4
-1@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. */ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {
Signature · 1 line
Chuck Lever
Quoted 13 lines · Chuck Lever
Quoted 10 lines · Olga Kornievskaia
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
Quoted 3 lines
Removing all rpcbind registrations and then re-adding them might cause an outage for clients that attempt to mount the server right at that moment.
Ok I'll take a look at unregistering elsewhere. But to note, removing a listener is only allowed when no threads are running. Thus no mounts are possible.
Quoted 28 lines
Quoted 13 lines
Fixes d093c9089260 ("nfsd: fix management of listener transports")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +0
-0@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. fs/nfsd/nfsctl.c int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info) · line 2008
Quoted 10 lines
fs/nfsd/nfsctl.c +4
-1*/ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {--
Chuck Lever
Quoted 14 lines · Olga Kornievskaia
Quoted 13 lines · Chuck Lever
Quoted 10 lines · Olga Kornievskaia
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
Quoted 8 lines
Quoted 3 lines
Removing all rpcbind registrations and then re-adding them might cause an outage for clients that attempt to mount the server right at that moment.
Ok I'll take a look at unregistering elsewhere. But to note, removing a listener is only allowed when no threads are running. Thus no mounts are possible.
Right, which is why I think this is fine. There is a small chance a client might see the bogus rpcbind registration, but that's still better than the status quo.
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Fixes d093c9089260 ("nfsd: fix management of listener transports")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +4
-1@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. */ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }
Quoted 7 lines
Quoted 7 lines
fs/nfsd/nfsctl.c int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info) · line 2008
Quoted 2 lines
fs/nfsd/nfsctl.c +0
-0/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {--
Chuck Lever
Quoted 19 lines · Jeff Layton
Quoted 18 lines · Olga Kornievskaia
Quoted 16 lines · Chuck Lever
Quoted 10 lines · Olga Kornievskaia
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
Removing all rpcbind registrations and then re-adding them might cause an outage for clients that attempt to mount the server right at that moment.
Quoted 6 lines
Quoted 4 lines
Ok I'll take a look at unregistering elsewhere. But to note, removing a listener is only allowed when no threads are running. Thus no mounts are possible.
Right, which is why I think this is fine.
I think Olga's proposed solution is "fine for now" but IMO it adds a bit of technical debt that we don't want, long term.
A better solution is to make NFSD listener creation and destruction complementary, if that's possible.
Quoted 34 lines
There is a small chance a
client might see the bogus rpcbind registration, but that's still better than the status quo.Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Fixes d093c9089260 ("nfsd: fix management of listener transports")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +4
-1@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. */ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }Quoted 7 lines
Quoted 7 lines
fs/nfsd/nfsctl.c int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info) · line 2008
Quoted 2 lines
fs/nfsd/nfsctl.c +0
-0/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {--
Chuck LeverReviewed-by Jeff Layton <[email protected]>
Signature · 1 line
Chuck Lever
Jeff Layton
maintainerQuoted 25 lines · Chuck Lever
Quoted 24 lines · Jeff Layton
Quoted 22 lines · Olga Kornievskaia
Quoted 13 lines · Chuck Lever
Quoted 10 lines · Olga Kornievskaia
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
Quoted 3 lines
Removing all rpcbind registrations and then re-adding them might cause an outage for clients that attempt to mount the server right at that moment.
Ok I'll take a look at unregistering elsewhere. But to note, removing a listener is only allowed when no threads are running. Thus no mounts are possible.
Quoted 8 lines
Quoted 1 line
Right, which is why I think this is fine.
I think Olga's proposed solution is "fine for now" but IMO it adds a bit of technical debt that we don't want, long term.
A better solution is to make NFSD listener creation and destruction complementary, if that's possible.
Agreed, but that's a bigger project. Note that the patch below is just adding rpcbind dereg/reg to what the netlink interface is already doing. It already blows away all of the listeners and recreates them when one is removed.
Changing that is a bigger project, and at that point we might as well also allow the removal of listeners while the server is up. I'm not opposed to that, but it may be considerably larger change.
Quoted 36 lines
Quoted 35 lines
There is a small chance a
client might see the bogus rpcbind registration, but that's still better than the status quo.Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Fixes d093c9089260 ("nfsd: fix management of listener transports")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +4
-1@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. */ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }Quoted 7 lines
Quoted 7 lines
fs/nfsd/nfsctl.c int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info) · line 2008
Quoted 2 lines
fs/nfsd/nfsctl.c +0
-0/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {--
Chuck LeverReviewed-by Jeff Layton <[email protected]>
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 35 lines · Jeff Layton
Quoted 25 lines · Chuck Lever
Quoted 24 lines · Jeff Layton
Quoted 22 lines · Olga Kornievskaia
Quoted 13 lines · Chuck Lever
Quoted 10 lines · Olga Kornievskaia
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
Quoted 3 lines
Removing all rpcbind registrations and then re-adding them might cause an outage for clients that attempt to mount the server right at that moment.
Ok I'll take a look at unregistering elsewhere. But to note, removing a listener is only allowed when no threads are running. Thus no mounts are possible.
Quoted 8 lines
Quoted 1 line
Right, which is why I think this is fine.
I think Olga's proposed solution is "fine for now" but IMO it adds a bit of technical debt that we don't want, long term.
A better solution is to make NFSD listener creation and destruction complementary, if that's possible.
Quoted 8 lines
Agreed, but that's a bigger project. Note that the patch below is just adding rpcbind dereg/reg to what the netlink interface is already doing. It already blows away all of the listeners and recreates them when one is removed.
Changing that is a bigger project, and at that point we might as well also allow the removal of listeners while the server is up. I'm not opposed to that, but it may be considerably larger change.
Change size doesn't worry me that much (it will need some strategy, though).
But two practical questions, then:
1. Does Olga's fix need to be backported to one or more LTS kernels? If it does, the narrower fix is probably better for now.
2. Is there a concern that the "larger" change will result in ABI incompatibility?
IMO both of the current behaviors (replacing all registrations and requiring the server to be shutdown) have negative impact on server availability. Adding or removing additional listeners should be seamless.
Quoted 36 lines
Quoted 35 lines
Quoted 34 lines
There is a small chance a
client might see the bogus rpcbind registration, but that's still better than the status quo.Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Fixes d093c9089260 ("nfsd: fix management of listener transports")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +4
-1@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. */ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }Quoted 7 lines
Quoted 7 lines
fs/nfsd/nfsctl.c int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info) · line 2008
Quoted 2 lines
fs/nfsd/nfsctl.c +0
-0/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {--
Chuck LeverReviewed-by Jeff Layton <[email protected]>
Signature · 1 line
Chuck Lever
Tom Talpey
reviewerQuoted 10 lines · Olga Kornievskaia
When a listener is added, a part of creation of transport also registers program/port with rpcbind. However, when the listener is removed, while transport goes away, rpcbind still has the entry for that port/type.
Removal of listeners works by first removing all transports and then re-adding the ones that were not removed. In addition to destroying all transports, now also call the function that unregisters everything with the rpcbind. But we also then need to call the rpcbind setup function before adding back new transports.
The rpcbind and portmap protocols both define PROC_UNSET procedures to selectively remove the triplets. Is it not feasible to code a new client stub to simply invoke them, instead of the legacy big-hammer?
Tom.
Quoted 23 lines
Fixes d093c9089260 ("nfsd: fix management of listener transports")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +4
-1@@ -1998,8 +1998,11 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)* Since we can't delete an arbitrary llist entry, destroy the * remaining listeners and recreate the list. */ -if (delete) +if (delete) {svc_xprt_destroy_all (serv, net); +svc_rpcb_cleanup (serv, net); +svc_bind (serv, net); + }/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr (attr, info->nlhdr,GENL_HDRLEN , rem) {