On Tue, Aug 03, 2010 at 11:48:51AM -0400, J. Bruce Fields wrote: > On Tue, Aug 03, 2010 at 10:09:03AM +0900, Tetsuo Handa wrote: > > Hello. > > > > That patch solved the NULL pointer dereference problem. Thank you. > > > > But I got another problem. After applying that patch on 2.6.35-next-20100802 , > > mount operation fails with timeout error. > > Argh, yes, problem found, I think--I'll do some more testing and send > you another attempt.... How about this? (By the way, are you using something other than the standard /etc/init.d/nfs-kernel-server to start/stop the server? Or have you customized your installation in any way? Just curious, as the bugs you're finding are good, but I'd expect different symptoms from the default setup.) --b. commit 3deb279d6e5625407919a875db3a2461199566b3 Author: J. Bruce Fields <bfields@xxxxxxxxxx> Date: Mon Aug 2 14:12:44 2010 -0400 nfsd: fix startup/shutdown order bug We must create the server before we can call init_socks or check the number of threads. Symptoms were a NULL pointer dereference in nfsd_svc(). Problem identified by Jeff Layton. Reported-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 92173bd..58e3d4c 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -420,7 +420,7 @@ int nfsd_svc(unsigned short port, int nrservs) { int error; - bool first_thread; + bool unstarted, first_thread; mutex_lock(&nfsd_mutex); dprintk("nfsd: creating service\n"); @@ -432,29 +432,31 @@ nfsd_svc(unsigned short port, int nrservs) if (nrservs == 0 && nfsd_serv == NULL) goto out; - first_thread = (nfsd_serv->sv_nrthreads == 0) && (nrservs != 0); + unstarted = nfsd_serv == NULL || nfsd_serv->sv_nrthreads == 0; + first_thread = unstarted && (nrservs != 0); + + error = nfsd_create_serv(); + if (error) + goto out; if (first_thread) { error = nfsd_startup(port, nrservs); if (error) - goto out; + goto out_destroy; } - error = nfsd_create_serv(); - if (error) - goto out_shutdown; error = svc_set_num_threads(nfsd_serv, NULL, nrservs); if (error) - goto out_destroy; + goto out_shutdown; /* We are holding a reference to nfsd_serv which * we don't want to count in the return value, * so subtract 1 */ error = nfsd_serv->sv_nrthreads - 1; -out_destroy: - svc_destroy(nfsd_serv); /* Release server */ out_shutdown: if (error < 0 && first_thread) nfsd_shutdown(); +out_destroy: + svc_destroy(nfsd_serv); /* Release server */ out: mutex_unlock(&nfsd_mutex); return error; -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html