The patch titled knfsd: separate out some parts of nfsd_svc, which start nfs servers has been added to the -mm tree. Its filename is knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: knfsd: separate out some parts of nfsd_svc, which start nfs servers From: NeilBrown <neilb@xxxxxxx> Separate out the code for creating a new service, and for creating initial sockets. Some of these new functions will have multiple callers soon. Signed-off-by: Neil Brown <neilb@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/nfsd/nfssvc.c | 82 +++++++++++++++++++++++++++++++-------------- 1 file changed, 57 insertions(+), 25 deletions(-) diff -puN fs/nfsd/nfssvc.c~knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers fs/nfsd/nfssvc.c --- a/fs/nfsd/nfssvc.c~knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers +++ a/fs/nfsd/nfssvc.c @@ -195,6 +195,53 @@ void nfsd_reset_versions(void) } } + +static inline int nfsd_create_serv(void) +{ + int err = 0; + lock_kernel(); + if (nfsd_serv) { + nfsd_serv->sv_nrthreads++; + unlock_kernel(); + return 0; + } + + atomic_set(&nfsd_busy, 0); + nfsd_serv = svc_create(&nfsd_program, NFSD_BUFSIZE, + nfsd_last_thread); + if (nfsd_serv == NULL) + err = -ENOMEM; + else + nfsd_serv->sv_nrthreads++; + unlock_kernel(); + do_gettimeofday(&nfssvc_boot); /* record boot time */ + return err; +} + +static inline int nfsd_init_socks(int port) +{ + int error; + if (!list_empty(&nfsd_serv->sv_permsocks)) + return 0; + + error = svc_makesock(nfsd_serv, IPPROTO_UDP, port); + if (error < 0) + return error; + error = lockd_up(IPPROTO_UDP); + if (error < 0) + return error; + +#ifdef CONFIG_NFSD_TCP + error = svc_makesock(nfsd_serv, IPPROTO_TCP, port); + if (error < 0) + return error; + error = lockd_up(IPPROTO_TCP); + if (error < 0) + return error; +#endif + return 0; +} + int nfsd_svc(unsigned short port, int nrservs) { @@ -216,32 +263,17 @@ nfsd_svc(unsigned short port, int nrserv error = nfs4_state_start(); if (error<0) goto out; - if (!nfsd_serv) { - nfsd_reset_versions(); - atomic_set(&nfsd_busy, 0); - error = -ENOMEM; - nfsd_serv = svc_create(&nfsd_program, NFSD_BUFSIZE, - nfsd_last_thread); - if (nfsd_serv == NULL) - goto out; - error = svc_makesock(nfsd_serv, IPPROTO_UDP, port); - if (error < 0) - goto failure; - error = lockd_up(IPPROTO_UDP); - if (error < 0) - goto failure; -#ifdef CONFIG_NFSD_TCP - error = svc_makesock(nfsd_serv, IPPROTO_TCP, port); - if (error < 0) - goto failure; - error = lockd_up(IPPROTO_TCP); - if (error < 0) - goto failure; -#endif - do_gettimeofday(&nfssvc_boot); /* record boot time */ - } else - nfsd_serv->sv_nrthreads++; + nfsd_reset_versions(); + + error = nfsd_create_serv(); + + if (error) + goto out; + error = nfsd_init_socks(port); + if (error) + goto failure; + nrservs -= (nfsd_serv->sv_nrthreads-1); while (nrservs > 0) { nrservs--; _ Patches currently in -mm which might be from neilb@xxxxxxx are ext3-avoid-triggering-ext3_error-on-bad-nfs-file-handle.patch ext3-avoid-triggering-ext3_error-on-bad-nfs-file-handle-fix.patch git-klibc.patch ext3-reject-filehandles-referring-to-special-files.patch ext2-reject-file-handles-with-bad-inode-numbers-early.patch knfsd-knfsd-add-some-missing-newlines-in-printks.patch knfsd-knfsd-remove-an-unused-variable-from-e_show.patch knfsd-knfsd-remove-an-unused-variable-from-auth_unix_lookup.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-tidy.patch knfsd-be-more-selective-in-which-sockets-lockd-listens-on.patch knfsd-remove-nfsd_versbits-as-intermediate-storage-for-desired-versions.patch knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers.patch knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers-tweaks.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-tidy.patch knfsd-allow-sockets-to-be-passed-to-nfsd-via-portlist.patch md-dm-reduce-stack-usage-with-stacked-block-devices.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html