On Oct 13, 2010, at 11:12 AM, Steve Dickson wrote: > > > On 10/13/2010 10:55 AM, Steve Dickson wrote: >> >> >> On 10/10/2010 08:04 PM, Chuck Lever wrote: >>> Clear stale MNT registrations before mountd tries to create fresh >>> listeners, to ensure that mountd starts. This is also what statd >>> does. >>> >>> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> >>> --- >>> >>> utils/mountd/mountd.c | 1 + >>> 1 files changed, 1 insertions(+), 0 deletions(-) >>> >>> diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c >>> index d309950..7e0cf6a 100644 >>> --- a/utils/mountd/mountd.c >>> +++ b/utils/mountd/mountd.c >>> @@ -840,6 +840,7 @@ main(int argc, char **argv) >>> if (new_cache) >>> cache_open(); >>> >>> + unregister_services(); >>> if (version2()) { >>> listeners += nfs_svc_create("mountd", MOUNTPROG, >>> MOUNTVERS, mount_dispatch, port); >>> >> Question, since unregister_services() only unregisters version >> that are currently requested, won't it miss unregistering >> version that are not currently requested, ones that are left over >> from a previous instant of mountd? >> >> The point being all versions need to be unregistered at his point, >> not just the ones currently being requested. I actually don't see a case where you would want to unregister just specific versions. unregister_services() is currently too clever, by half. The best thing to do is have unregister_services unregister everything, unconditionally. So, add the new unregister_services() call site as my patch does, but change unregister_services() itself to do something like: nfs_svc_unregister(MOUNTPROG, MOUNTVERS); nfs_svc_unregister(MOUNTPROG, MOUNTVERS_POSIX); nfs_svc_unregister(MOUNTPROG, NFSV3); What do you think? > Something like: > > mountd: Clear mountd registrations at start up > > Clear stale MNT registrations before mountd tries to create fresh > listeners, to ensure that mountd starts. This is also what statd > does. > > Signed-off-by: Steve Dickson <steved@xxxxxxxxxx> > > diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c > index d309950..c36c471 100644 > --- a/utils/mountd/mountd.c > +++ b/utils/mountd/mountd.c > @@ -97,13 +97,13 @@ static int version_any(void) > } > > static void > -unregister_services (void) > +unregister_services (int all) > { > - if (version2()) { > + if (all || version2()) { > nfs_svc_unregister(MOUNTPROG, MOUNTVERS); > nfs_svc_unregister(MOUNTPROG, MOUNTVERS_POSIX); > } > - if (version3()) > + if (all || version3()) > nfs_svc_unregister(MOUNTPROG, MOUNTVERS_NFSV3); > } > > @@ -180,7 +180,7 @@ fork_workers(void) > > /* in parent */ > wait_for_workers(); > - unregister_services(); > + unregister_services(0); > cleanup_lockfiles(); > xlog(L_NOTICE, "mountd: no more workers, exiting\n"); > exit(0); > @@ -192,7 +192,7 @@ fork_workers(void) > static void > killer (int sig) > { > - unregister_services(); > + unregister_services(0); > if (num_threads > 1) { > /* play Kronos and eat our children */ > kill(0, SIGTERM); > @@ -840,6 +840,7 @@ main(int argc, char **argv) > if (new_cache) > cache_open(); > > + unregister_services(1); > if (version2()) { > listeners += nfs_svc_create("mountd", MOUNTPROG, > MOUNTVERS, mount_dispatch, port); > @@ -895,7 +896,7 @@ main(int argc, char **argv) > my_svc_run(); > > xlog(L_ERROR, "RPC service loop terminated unexpectedly. Exiting...\n"); > - unregister_services(); > + unregister_services(0); > exit(1); > } > > -- chuck[dot]lever[at]oracle[dot]com -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html