/* * Create the nfs service for amd */ int create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp)) { *soNFSp = socket(AF_INET, SOCK_DGRAM, 0); if (*soNFSp < 0 || bind_resv_port(*soNFSp, nfs_portp) < 0) { plog(XLOG_FATAL, "Can't create privileged nfs port (socket)"); if (*soNFSp >= 0) close(*soNFSp); return 1; } if ((*nfs_xprtp = svcudp_create(*soNFSp)) == NULL) { plog(XLOG_FATAL, "cannot create rpc/udp service"); close(*soNFSp); return 2; } if ((*nfs_portp = (*nfs_xprtp)->xp_port) >= IPPORT_RESERVED) { plog(XLOG_FATAL, "Can't create privileged nfs port"); svc_destroy(*nfs_xprtp); close(*soNFSp); return 1; } if (!svc_register(*nfs_xprtp, NFS_PROGRAM, NFS_VERSION, dispatch_fxn, 0)) { plog(XLOG_FATAL, "unable to register (%ld, %ld, 0)", (u_long) NFS_PROGRAM, (u_long) NFS_VERSION); svc_destroy(*nfs_xprtp); close(*soNFSp); return 3; } return 0; /* all is well */ }
int daVarServUnSet(int prog, int version) { register SVCXPRT *transp; if(prog==0) prog = last_program; if(version==0) version = last_version; (void) pmap_unset(prog,version); if(prog==last_program && version == last_version){ if(udp_transp) svc_destroy(udp_transp); if(tcp_transp) svc_destroy(tcp_transp); } return(0); }
int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int sock = 600; SVCXPRT *svcr = NULL; //create a server // sock = socket(AF_UNIX, SOCK_SEQPACKET, IPPROTO_UDP); svcr = svcudp_bufcreate(sock, 1500, 1500); //check returned value test_status = ((SVCXPRT *) svcr != NULL) ? 0 : 1; //clean up svc_destroy(svcr); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
int main(void) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case int test_status = 1; //Default test result set to FAILED int sock = 600; SVCXPRT *svcr = NULL; //create a server sock = socket(AF_UNIX, SOCK_DGRAM, IPPROTO_TCP); svcr = svctcp_create(sock, 0, 0); test_status = (svcr != NULL) ? 0 : 1; //clean up svc_destroy(svcr); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED SVCXPRT *svcr = NULL; int fd = 0; //create a server svcr = svcfd_create(fd, 1024, 1024); //call routine xprt_register(svcr); //If we are here, xprt_register returned : test has passed test_status = 0; //clean up svc_destroy(svcr); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
int *is_alive_6_svc( unsigned *id, struct svc_req *rqstp) { static int alive; SVCXPRT * const xprt = rqstp->rq_xprt; int error = 0; alive = cps_contains((pid_t) *id); if (ulogIsDebug()) { udebug("LDM %u is %s", *id, alive ? "alive" : "dead"); } if (!svc_sendreply(xprt, (xdrproc_t) xdr_bool, (caddr_t) &alive)) { svcerr_systemerr(xprt); error = 1; } if (!svc_freeargs(xprt, xdr_u_int, (caddr_t)id)) { uerror("Couldn't free arguments"); error = 1; } svc_destroy(xprt); exit(error); /*NOTREACHED*/ return NULL ; }
/* * Bring up the callback thread if it is not already up. */ int nfs_callback_up(void) { struct svc_serv *serv = NULL; int ret = 0; mutex_lock(&nfs_callback_mutex); if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) goto out; serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, nfs_callback_family, NULL); ret = -ENOMEM; if (!serv) goto out_err; ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS); if (ret <= 0) goto out_err; nfs_callback_tcpport = ret; dprintk("NFS: Callback listener port = %u (af %u)\n", nfs_callback_tcpport, nfs_callback_family); nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]); if (IS_ERR(nfs_callback_info.rqst)) { ret = PTR_ERR(nfs_callback_info.rqst); nfs_callback_info.rqst = NULL; goto out_err; } svc_sock_update_bufs(serv); nfs_callback_info.task = kthread_run(nfs_callback_svc, nfs_callback_info.rqst, "nfsv4-svc"); if (IS_ERR(nfs_callback_info.task)) { ret = PTR_ERR(nfs_callback_info.task); svc_exit_thread(nfs_callback_info.rqst); nfs_callback_info.rqst = NULL; nfs_callback_info.task = NULL; goto out_err; } out: /* * svc_create creates the svc_serv with sv_nrthreads == 1, and then * svc_prepare_thread increments that. So we need to call svc_destroy * on both success and failure so that the refcount is 1 when the * thread exits. */ if (serv) svc_destroy(serv); mutex_unlock(&nfs_callback_mutex); return ret; out_err: dprintk("NFS: Couldn't create callback socket or server thread; " "err = %d\n", ret); nfs_callback_info.users--; goto out; }
/* * Bring up the lockd process if it's not already up. */ int lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */ { struct svc_serv * serv; int error = 0; mutex_lock(&nlmsvc_mutex); /* * Check whether we're already up and running. */ if (nlmsvc_pid) { if (proto) error = make_socks(nlmsvc_serv, proto); goto out; } /* * Sanity check: if there's no pid, * we should be the first user ... */ if (nlmsvc_users) printk(KERN_WARNING "lockd_up: no pid, %d users??\n", nlmsvc_users); error = -ENOMEM; serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL); if (!serv) { printk(KERN_WARNING "lockd_up: create service failed\n"); goto out; } if ((error = make_socks(serv, proto)) < 0) goto destroy_and_out; /* * Create the kernel thread and wait for it to start. */ error = svc_create_thread(lockd, serv); if (error) { printk(KERN_WARNING "lockd_up: create thread failed, error=%d\n", error); goto destroy_and_out; } wait_for_completion(&lockd_start_done); /* * Note: svc_serv structures have an initial use count of 1, * so we exit through here on both success and failure. */ destroy_and_out: svc_destroy(serv); out: if (!error) nlmsvc_users++; mutex_unlock(&nlmsvc_mutex); return error; }
static void up7_destroy( Up7* const up7) { svc_unregister(LDMPROG, SEVEN); if (up7->xprt) svc_destroy(up7->xprt); up7->xprt = NULL; }
/* * Create the nfs service for amd * return 0 (TRUE) if OK, 1 (FALSE) if failed. */ int create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp), u_long nfs_version) { char *nettype = "ticlts"; nfsncp = getnetconfigent(nettype); if (nfsncp == NULL) { plog(XLOG_ERROR, "cannot getnetconfigent for %s", nettype); /* failed with ticlts, try plain udp (hpux11) */ nettype = "udp"; nfsncp = getnetconfigent(nettype); if (nfsncp == NULL) { plog(XLOG_ERROR, "cannot getnetconfigent for %s", nettype); return 1; } } *nfs_xprtp = svc_tli_create(RPC_ANYFD, nfsncp, NULL, 0, 0); if (*nfs_xprtp == NULL) { plog(XLOG_ERROR, "cannot create nfs tli service for amd"); return 1; } /* * Get the service file descriptor and check its number to see if * the t_open failed. If it succeeded, then go on to binding to a * reserved nfs port. */ *soNFSp = (*nfs_xprtp)->xp_fd; if (*soNFSp < 0 || bind_nfs_port(*soNFSp, nfs_portp) < 0) { plog(XLOG_ERROR, "Can't create privileged nfs port (TLI)"); svc_destroy(*nfs_xprtp); return 1; } if (svc_reg(*nfs_xprtp, NFS_PROGRAM, nfs_version, dispatch_fxn, NULL) != 1) { plog(XLOG_ERROR, "could not register amd NFS service"); svc_destroy(*nfs_xprtp); return 1; } return 0; /* all is well */ }
void loc_apicb_app_deinit(void) { if (svrPort == NULL) { return; } svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001); xprt_unregister(svrPort); svc_destroy(svrPort); svrPort = NULL; }
/*ARGSUSED1*/ void *blkdata_6_svc( datapkt *argp, struct svc_req *rqstp) { int error = down6_blkdata(argp); if (error && DOWN6_UNWANTED != error && DOWN6_PQ_BIG != error) { (void) svcerr_systemerr(rqstp->rq_xprt); svc_destroy(rqstp->rq_xprt); exit(error); } return NULL ; /* don't reply */ }
/************************************************************************ * * * Unregister all receiver message ports. * * */ void ipgwin_unregister_msg(void) { Svcmsg *temp; while (svchead) { svc_unregister(svchead->prognum, svchead->versnum); svc_destroy(svchead->xprt); temp = svchead->next; (void)free((char *)svchead); svchead = temp; } }
int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int progNum = atoi(argc[2]); char nettype[16] = "visible"; SVCXPRT *svcr; struct netconfig *nconf; //Test initialization if ((nconf = getnetconfigent("tcp")) == (struct netconfig *)NULL){ fprintf(stderr, "Cannot get netconfig entry for TCP\n"); exit(1); } if (run_mode == 1) { printf("Server : %s\n", argc[1]); printf("Server # %d\n", progNum); } //First create server svcr = svc_tp_create(exm_proc, progNum, VERSNUM, nconf); //Prepare destruction svc_unreg(progNum, VERSNUM); //then destroy it svc_destroy(svcr); svc_unreg(progNum, VERSNUM); //If we are here, test has passed test_status = 0; //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
static void on_stop() { DEBUG_FUNCTION; svc_exit(); svc_unregister(STORAGE_PROGRAM, STORAGE_VERSION); pmap_unset(STORAGE_PROGRAM, STORAGE_VERSION); if (storaged_svc) { svc_destroy(storaged_svc); storaged_svc = NULL; } storaged_release(); rozofs_release(); info("stopped."); closelog(); }
/** * Notifies a downstream LDM of subscribed-to data-products. * <p> * This function will not normally return unless the request necessitates a * reply (e.g., RECLASS). */ fornme_reply_t *notifyme_6_svc( prod_class_t* want, struct svc_req* rqstp) { SVCXPRT* const xprt = rqstp->rq_xprt; fornme_reply_t* reply = feed_or_notify(xprt, want, 1, 0); if (!svc_freeargs(xprt, xdr_prod_class, (caddr_t)want)) { uerror("Couldn't free arguments"); svc_destroy(xprt); exit(1); } return reply; }
/* * Destroy an RPC server thread */ void svc_exit_thread(struct svc_rqst *rqstp) { struct svc_serv *serv = rqstp->rq_server; svc_release_buffer(rqstp); kfree(rqstp->rq_resp); kfree(rqstp->rq_argp); kfree(rqstp->rq_auth_data); kfree(rqstp); /* Release the server */ if (serv) svc_destroy(serv); }
/** * Sends a downstream LDM subscribed-to data-products. * <p> * This function will not normally return unless the request necessitates a * reply (e.g., RECLASS). */ fornme_reply_t *feedme_6_svc( feedpar_t *feedPar, struct svc_req *rqstp) { SVCXPRT* const xprt = rqstp->rq_xprt; prod_class_t* want = feedPar->prod_class; fornme_reply_t* reply = feed_or_notify(xprt, want, 0, feedPar->max_hereis); if (!svc_freeargs(xprt, xdr_feedpar_t, (caddr_t)feedPar)) { uerror("Couldn't free arguments"); svc_destroy(xprt); exit(1); } return reply; }
int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // argc[3] : Number of testes function calls // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int sock = 600; SVCXPRT *svcr = NULL; int nbCall = atoi(argc[3]); int nbOk = 0; int i; //create a server // sock = socket(AF_UNIX, SOCK_SEQPACKET, IPPROTO_UDP); for (i = 0; i < nbCall; i++) { svcr = svcudp_create(sock); if (svcr != (SVCXPRT *)NULL) nbOk++; } //If we are here, macro call was successful if (run_mode == 1) { printf("Aimed : %d\n", nbCall); printf("Got : %d\n", nbOk); } test_status = (nbOk == nbCall) ? 0 : 1; //clean up svc_destroy(svcr); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
void svc_exit_thread(struct svc_rqst *rqstp) { struct svc_serv *serv = rqstp->rq_server; struct svc_pool *pool = rqstp->rq_pool; spin_lock_bh(&pool->sp_lock); pool->sp_nrthreads--; if (!test_and_set_bit(RQ_VICTIM, &rqstp->rq_flags)) list_del_rcu(&rqstp->rq_all); spin_unlock_bh(&pool->sp_lock); svc_rqst_free(rqstp); /* Release the server */ if (serv) svc_destroy(serv); }
/*ARGSUSED1*/ comingsoon_reply_t *comingsoon_6_svc( comingsoon_args *comingPar, struct svc_req *rqstp) { static comingsoon_reply_t reply; int error = down6_comingsoon(comingPar); if (error == 0) { reply = OK; } else if (DOWN6_UNWANTED == error || DOWN6_PQ_BIG == error) { reply = DONT_SEND; } else { (void) svcerr_systemerr(rqstp->rq_xprt); svc_destroy(rqstp->rq_xprt); exit(error); } return &reply; }
void *hereis_6_svc( product *prod, struct svc_req *rqstp) { if (dp_isNil(prod)) { /* * The upstream LDM sent a nil data-product to flush the connection. */ } else { int error = down6_hereis(prod); if (error && DOWN6_UNWANTED != error && DOWN6_PQ_BIG != error) { (void) svcerr_systemerr(rqstp->rq_xprt); svc_destroy(rqstp->rq_xprt); exit(error); } } return NULL ; /* don't reply */ }
int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int progNum = atoi(argc[2]); SVCXPRT *svcr = NULL; int rslt; //Initialisation pmap_unset(progNum, VERSNUM); //create a server svcr = svcudp_create(RPC_ANYSOCK); //call routine rslt = registerrpc(progNum, VERSNUM, PROCNUM, simplePing, xdr_int, xdr_int); if (run_mode) { printf("SVC : %d\n", svcr); printf("rslt : %d\n", rslt); } test_status = (rslt == 0) ? 0 : 1; //clean up svc_destroy(svcr); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
/* * A transport listener is added by writing it's transport name and * a port number. */ static ssize_t __write_ports_addxprt(char *buf) { char transport[16]; struct svc_xprt *xprt; int port, err; if (sscanf(buf, "%15s %4u", transport, &port) != 2) return -EINVAL; if (port < 1 || port > USHRT_MAX) return -EINVAL; err = nfsd_create_serv(); if (err != 0) return err; err = svc_create_xprt(nfsd_serv, transport, &init_net, PF_INET, port, SVC_SOCK_ANONYMOUS); if (err < 0) goto out_err; err = svc_create_xprt(nfsd_serv, transport, &init_net, PF_INET6, port, SVC_SOCK_ANONYMOUS); if (err < 0 && err != -EAFNOSUPPORT) goto out_close; /* Decrease the count, but don't shut down the service */ nfsd_serv->sv_nrthreads--; return 0; out_close: xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port); if (xprt != NULL) { svc_close_xprt(xprt); svc_xprt_put(xprt); } out_err: svc_destroy(nfsd_serv); return err; }
int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int progNum = atoi(argc[2]); SVCXPRT *svcr = NULL; //Initialisation pmap_unset(progNum, VERSNUM); //create a server svcr = svctcp_create(RPC_ANYSOCK, 0, 0); svc_register(svcr, progNum, VERSNUM, dispatch, IPPROTO_TCP); if (run_mode) { printf("SVC : %p\n", svcr); } //call routine svc_unregister(progNum, VERSNUM); //If we are here, test has passed test_status = 0; //clean up svc_destroy(svcr); //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); return test_status; }
/* * A single 'fd' number was written, in which case it must be for * a socket of a supported family/protocol, and we use it as an * nfsd listener. */ static ssize_t __write_ports_addfd(char *buf) { char *mesg = buf; int fd, err; err = get_int(&mesg, &fd); if (err != 0 || fd < 0) return -EINVAL; err = nfsd_create_serv(); if (err != 0) return err; err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT); if (err < 0) { svc_destroy(nfsd_serv); return err; } /* Decrease the count, but don't shut down the service */ nfsd_serv->sv_nrthreads--; return err; }
int main(void) { int test_status = 1; SVCXPRT *transp = NULL; int sock; sock = bound_socket(AF_INET, SOCK_DGRAM); if (sock < 0) { perror("bound_socket() failed"); return 1; } transp = svc_dg_create(sock, 0, 0); test_status = ((SVCXPRT *) transp != NULL) ? 0 : 1; if (transp != NULL) svc_destroy(transp); close(sock); printf("%d\n", test_status); return test_status; }
/* * Bring up the lockd process if it's not already up. */ int lockd_up(struct net *net) { struct svc_serv *serv; int error; mutex_lock(&nlmsvc_mutex); serv = lockd_create_svc(); if (IS_ERR(serv)) { error = PTR_ERR(serv); goto err_create; } error = lockd_up_net(serv, net); if (error < 0) goto err_net; error = lockd_start_svc(serv); if (error < 0) goto err_start; nlmsvc_users++; /* * Note: svc_serv structures have an initial use count of 1, * so we exit through here on both success and failure. */ err_net: svc_destroy(serv); err_create: mutex_unlock(&nlmsvc_mutex); return error; err_start: lockd_down_net(serv, net); goto err_net; }
/************************************************************************ * * * This routine is used to register a specific function which will be * * called when there is a message. * * User function to be called can be NULL, indicating unregistering * * message, or user-func address, which takes a form of * * func(u_long proc_id, where proc_id is ID number. * * Ipgmsg *msg) where msg is a message. * * * * Return program number for success and 0 for failure. * * * * In RPC term, SERVER registers/unregisters program and version number * * */ u_long ipgwin_register_msg_receive( u_long prognum, /* program ID */ u_long versnum, /* program version */ void (*userfunc)(u_long, Ipgmsg*)) { Svcmsg *current, *prev; /* ptrs used for message item */ Svcmsg *newitem; /* new created item */ SVCXPRT *transp; /* transport info */ int protocol; /* protocol */ /* Check if the msgid has been registered or not. If the message */ /* has been registered, only change the user function. If the user */ /* function is NULL, delete the message item from the list. If the */ /* message has not been registered, add the new message item at the */ /* first of the list. */ for (current=prev=svchead; current; prev=current, current=current->next) { if ((current->prognum == prognum) && (current->versnum == versnum)) /* Found */ { svc_unregister(current->prognum, current->versnum); svc_destroy(current->xprt); if (current == prev) /* Only one item on the list */ svchead = NULL; else prev->next = current->next; (void)free((char *)current); if (userfunc == NULL) return(prognum) ; else break; } } /* Create an RPC with TCP socket */ if ((transp = svctcp_create(RPC_ANYSOCK, 0, 0)) == NULL) { STDERR("Can't create RPC"); return(0); } /* Get the "transient" program number if prognum is zero */ if (prognum == 0) { /* The "transient" program number starts at 0x40000000 */ /* Get the unused number. */ prognum = 0x40000000; while (!pmap_set(prognum, versnum, IPPROTO_TCP, transp->xp_port)) prognum++; /* We don't need to register it at svc_register since pmap_set */ /* has done it. */ protocol = 0; } else { /* Erase the pormapper's table */ pmap_unset(prognum, versnum); protocol = IPPROTO_TCP; } /* Register the portmapper. */ /* Note that Sun suggests that the program number ranges from */ /* 0x20000000 to 0x5fffffff. However, our routine doesn't */ /* check for this limit. */ #ifdef SOLARIS if (!svc_register(transp, prognum, versnum, ipgwin_priv_msg_receive, protocol)) #elif LINUX if (!svc_register(transp, prognum, versnum, ipgwin_priv_msg_receive, protocol)) #else if (!svc_register(transp, prognum, versnum, (void (*)(DOTDOTDOT))ipgwin_priv_msg_receive, protocol)) #endif { STDERR("ipgwin_register_msg_receive:Can't register RPC"); svc_destroy(transp); return(0); } /* Create new item */ if ((newitem = (Svcmsg *)malloc(sizeof(Svcmsg))) == NULL) { PERROR("ipgwin_register_message_receive:malloc:Message is not registered"); return(0); } newitem->xprt = transp; newitem->prognum = prognum; newitem->versnum = versnum; newitem->msgfunc = userfunc; /* Add a new item at the front of the list */ newitem->next = svchead; svchead = newitem; return(prognum); }
/* * Bring up the lockd process if it's not already up. */ int lockd_up(void) { struct svc_serv *serv; int error = 0; mutex_lock(&nlmsvc_mutex); /* * Check whether we're already up and running. */ if (nlmsvc_rqst) goto out; /* * Sanity check: if there's no pid, * we should be the first user ... */ if (nlmsvc_users) printk(KERN_WARNING "lockd_up: no pid, %d users??\n", nlmsvc_users); error = -ENOMEM; serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL); if (!serv) { printk(KERN_WARNING "lockd_up: create service failed\n"); goto out; } error = make_socks(serv); if (error < 0) goto destroy_and_out; /* * Create the kernel thread and wait for it to start. */ nlmsvc_rqst = svc_prepare_thread(serv, &serv->sv_pools[0]); if (IS_ERR(nlmsvc_rqst)) { error = PTR_ERR(nlmsvc_rqst); nlmsvc_rqst = NULL; printk(KERN_WARNING "lockd_up: svc_rqst allocation failed, error=%d\n", error); goto destroy_and_out; } svc_sock_update_bufs(serv); serv->sv_maxconn = nlm_max_connections; nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, serv->sv_name); if (IS_ERR(nlmsvc_task)) { error = PTR_ERR(nlmsvc_task); svc_exit_thread(nlmsvc_rqst); nlmsvc_task = NULL; nlmsvc_rqst = NULL; printk(KERN_WARNING "lockd_up: kthread_run failed, error=%d\n", error); goto destroy_and_out; } /* * Note: svc_serv structures have an initial use count of 1, * so we exit through here on both success and failure. */ destroy_and_out: svc_destroy(serv); out: if (!error) nlmsvc_users++; mutex_unlock(&nlmsvc_mutex); return error; }