patch-2.1.58 linux/net/sunrpc/svc.c
Next file: linux/net/sunrpc/svcsock.c
Previous file: linux/net/sunrpc/sched.c
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Sun Oct 12 10:17:46 1997
- Orig file:
v2.1.57/linux/net/sunrpc/svc.c
- Orig date:
Mon Apr 7 11:35:33 1997
diff -u --recursive --new-file v2.1.57/linux/net/sunrpc/svc.c linux/net/sunrpc/svc.c
@@ -62,8 +62,12 @@
serv->sv_program->pg_name,
serv->sv_nrthreads);
- if (--(serv->sv_nrthreads) != 0)
- return;
+ if (serv->sv_nrthreads) {
+ if (--(serv->sv_nrthreads) != 0)
+ return;
+ } else
+ printk("svc_destroy: no threads for serv=%p!\n", serv);
+
while ((svsk = serv->sv_allsocks) != NULL)
svc_delete_socket(svsk);
@@ -110,30 +114,31 @@
int
svc_create_thread(svc_thread_fn func, struct svc_serv *serv)
{
- struct svc_rqst *rqstp = 0;
- int error;
+ struct svc_rqst *rqstp;
+ int error = -ENOMEM;
- if (!(rqstp = kmalloc(sizeof(*rqstp), GFP_KERNEL)))
- return -ENOMEM;
+ rqstp = kmalloc(sizeof(*rqstp), GFP_KERNEL);
+ if (!rqstp)
+ goto out;
memset(rqstp, 0, sizeof(*rqstp));
if (!(rqstp->rq_argp = (u32 *) kmalloc(serv->sv_xdrsize, GFP_KERNEL))
|| !(rqstp->rq_resp = (u32 *) kmalloc(serv->sv_xdrsize, GFP_KERNEL))
- || !svc_init_buffer(&rqstp->rq_defbuf, serv->sv_bufsz)) {
- error = -ENOMEM;
- goto failure;
- }
+ || !svc_init_buffer(&rqstp->rq_defbuf, serv->sv_bufsz))
+ goto out_thread;
serv->sv_nrthreads++;
- if ((error = kernel_thread((int (*)(void *)) func, rqstp, 0)) < 0)
- goto failure;
-
rqstp->rq_server = serv;
- return 0;
+ error = kernel_thread((int (*)(void *)) func, rqstp, 0);
+ if (error < 0)
+ goto out_thread;
+ error = 0;
+out:
+ return error;
-failure:
+out_thread:
svc_exit_thread(rqstp);
- return error;
+ goto out;
}
/*
@@ -152,7 +157,8 @@
kfree(rqstp);
/* Release the server */
- svc_destroy(serv);
+ if (serv)
+ svc_destroy(serv);
}
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov