Message ID | 20111025101705.12689.68022.stgit@localhost6.localdomain6 |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, Oct 25, 2011 at 02:17:08PM +0300, Stanislav Kinsbursky wrote: > New function ("svc_uses_rpcbind") will be used to detect, that new service will > send portmapper register calls. For such services we will create rpcbind > clients and remove all stale portmap registrations. > Also, svc_rpcb_cleanup() will be set as sv_shutdown callback for such services > in case of this field wasn't initialized earlier. This will allow to destroy > rpcbind clients when no other users of them left. > > Note: Currently, any creating service will be detected as portmap user. > Probably, this is wrong. But now it depends on program versions "vs_hidden" > flag. > > Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> > > --- > net/sunrpc/svc.c | 11 +++++++++-- > 1 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c > index d2d61bf..918edc3 100644 > --- a/net/sunrpc/svc.c > +++ b/net/sunrpc/svc.c > @@ -454,8 +454,15 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, > spin_lock_init(&pool->sp_lock); > } > > - /* Remove any stale portmap registrations */ > - svc_unregister(serv); > + if (svc_uses_rpcbind(serv)) { > + if (svc_rpcb_setup(serv) < 0) { > + kfree(serv->sv_pools); > + kfree(serv); > + return NULL; Nit: could we convert this (and the previous failure to allocate sv_pools) to the usual pattern of collecting the cleanup at the end and jumping to it with a goto? Looks fine otherwise. --b. > + } > + if (!serv->sv_shutdown) > + serv->sv_shutdown = svc_rpcb_cleanup; > + } > > return serv; > } > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
28.10.2011 01:27, J. Bruce Fields пишет: > On Tue, Oct 25, 2011 at 02:17:08PM +0300, Stanislav Kinsbursky wrote: >> New function ("svc_uses_rpcbind") will be used to detect, that new service will >> send portmapper register calls. For such services we will create rpcbind >> clients and remove all stale portmap registrations. >> Also, svc_rpcb_cleanup() will be set as sv_shutdown callback for such services >> in case of this field wasn't initialized earlier. This will allow to destroy >> rpcbind clients when no other users of them left. >> >> Note: Currently, any creating service will be detected as portmap user. >> Probably, this is wrong. But now it depends on program versions "vs_hidden" >> flag. >> >> Signed-off-by: Stanislav Kinsbursky<skinsbursky@parallels.com> >> >> --- >> net/sunrpc/svc.c | 11 +++++++++-- >> 1 files changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c >> index d2d61bf..918edc3 100644 >> --- a/net/sunrpc/svc.c >> +++ b/net/sunrpc/svc.c >> @@ -454,8 +454,15 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, >> spin_lock_init(&pool->sp_lock); >> } >> >> - /* Remove any stale portmap registrations */ >> - svc_unregister(serv); >> + if (svc_uses_rpcbind(serv)) { >> + if (svc_rpcb_setup(serv)< 0) { >> + kfree(serv->sv_pools); >> + kfree(serv); >> + return NULL; > > Nit: could we convert this (and the previous failure to allocate > sv_pools) to the usual pattern of collecting the cleanup at the end and > jumping to it with a goto? > Sure, we can. I will implement this "goto pattern", is you insist. > Looks fine otherwise. > > --b. > >> + } >> + if (!serv->sv_shutdown) >> + serv->sv_shutdown = svc_rpcb_cleanup; >> + } >> >> return serv; >> } >>
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index d2d61bf..918edc3 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -454,8 +454,15 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, spin_lock_init(&pool->sp_lock); } - /* Remove any stale portmap registrations */ - svc_unregister(serv); + if (svc_uses_rpcbind(serv)) { + if (svc_rpcb_setup(serv) < 0) { + kfree(serv->sv_pools); + kfree(serv); + return NULL; + } + if (!serv->sv_shutdown) + serv->sv_shutdown = svc_rpcb_cleanup; + } return serv; }
New function ("svc_uses_rpcbind") will be used to detect, that new service will send portmapper register calls. For such services we will create rpcbind clients and remove all stale portmap registrations. Also, svc_rpcb_cleanup() will be set as sv_shutdown callback for such services in case of this field wasn't initialized earlier. This will allow to destroy rpcbind clients when no other users of them left. Note: Currently, any creating service will be detected as portmap user. Probably, this is wrong. But now it depends on program versions "vs_hidden" flag. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> --- net/sunrpc/svc.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html