svc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /*
  2. * linux/net/sunrpc/svc.c
  3. *
  4. * High-level RPC service routines
  5. *
  6. * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #include <linux/linkage.h>
  9. #include <linux/sched.h>
  10. #include <linux/errno.h>
  11. #include <linux/net.h>
  12. #include <linux/in.h>
  13. #include <linux/mm.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/module.h>
  16. #include <linux/sunrpc/types.h>
  17. #include <linux/sunrpc/xdr.h>
  18. #include <linux/sunrpc/stats.h>
  19. #include <linux/sunrpc/svcsock.h>
  20. #include <linux/sunrpc/clnt.h>
  21. #define RPCDBG_FACILITY RPCDBG_SVCDSP
  22. #define RPC_PARANOIA 1
  23. /*
  24. * Create an RPC service
  25. */
  26. static struct svc_serv *
  27. __svc_create(struct svc_program *prog, unsigned int bufsize, int npools,
  28. void (*shutdown)(struct svc_serv *serv))
  29. {
  30. struct svc_serv *serv;
  31. int vers;
  32. unsigned int xdrsize;
  33. unsigned int i;
  34. if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL)))
  35. return NULL;
  36. serv->sv_name = prog->pg_name;
  37. serv->sv_program = prog;
  38. serv->sv_nrthreads = 1;
  39. serv->sv_stats = prog->pg_stats;
  40. serv->sv_bufsz = bufsize? bufsize : 4096;
  41. serv->sv_shutdown = shutdown;
  42. xdrsize = 0;
  43. while (prog) {
  44. prog->pg_lovers = prog->pg_nvers-1;
  45. for (vers=0; vers<prog->pg_nvers ; vers++)
  46. if (prog->pg_vers[vers]) {
  47. prog->pg_hivers = vers;
  48. if (prog->pg_lovers > vers)
  49. prog->pg_lovers = vers;
  50. if (prog->pg_vers[vers]->vs_xdrsize > xdrsize)
  51. xdrsize = prog->pg_vers[vers]->vs_xdrsize;
  52. }
  53. prog = prog->pg_next;
  54. }
  55. serv->sv_xdrsize = xdrsize;
  56. INIT_LIST_HEAD(&serv->sv_tempsocks);
  57. INIT_LIST_HEAD(&serv->sv_permsocks);
  58. init_timer(&serv->sv_temptimer);
  59. spin_lock_init(&serv->sv_lock);
  60. serv->sv_nrpools = npools;
  61. serv->sv_pools =
  62. kcalloc(sizeof(struct svc_pool), serv->sv_nrpools,
  63. GFP_KERNEL);
  64. if (!serv->sv_pools) {
  65. kfree(serv);
  66. return NULL;
  67. }
  68. for (i = 0; i < serv->sv_nrpools; i++) {
  69. struct svc_pool *pool = &serv->sv_pools[i];
  70. dprintk("initialising pool %u for %s\n",
  71. i, serv->sv_name);
  72. pool->sp_id = i;
  73. INIT_LIST_HEAD(&pool->sp_threads);
  74. INIT_LIST_HEAD(&pool->sp_sockets);
  75. INIT_LIST_HEAD(&pool->sp_all_threads);
  76. spin_lock_init(&pool->sp_lock);
  77. }
  78. /* Remove any stale portmap registrations */
  79. svc_register(serv, 0, 0);
  80. return serv;
  81. }
  82. struct svc_serv *
  83. svc_create(struct svc_program *prog, unsigned int bufsize,
  84. void (*shutdown)(struct svc_serv *serv))
  85. {
  86. return __svc_create(prog, bufsize, /*npools*/1, shutdown);
  87. }
  88. struct svc_serv *
  89. svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
  90. void (*shutdown)(struct svc_serv *serv),
  91. svc_thread_fn func, int sig, struct module *mod)
  92. {
  93. struct svc_serv *serv;
  94. serv = __svc_create(prog, bufsize, /*npools*/1, shutdown);
  95. if (serv != NULL) {
  96. serv->sv_function = func;
  97. serv->sv_kill_signal = sig;
  98. serv->sv_module = mod;
  99. }
  100. return serv;
  101. }
  102. /*
  103. * Destroy an RPC service. Should be called with the BKL held
  104. */
  105. void
  106. svc_destroy(struct svc_serv *serv)
  107. {
  108. struct svc_sock *svsk;
  109. dprintk("RPC: svc_destroy(%s, %d)\n",
  110. serv->sv_program->pg_name,
  111. serv->sv_nrthreads);
  112. if (serv->sv_nrthreads) {
  113. if (--(serv->sv_nrthreads) != 0) {
  114. svc_sock_update_bufs(serv);
  115. return;
  116. }
  117. } else
  118. printk("svc_destroy: no threads for serv=%p!\n", serv);
  119. del_timer_sync(&serv->sv_temptimer);
  120. while (!list_empty(&serv->sv_tempsocks)) {
  121. svsk = list_entry(serv->sv_tempsocks.next,
  122. struct svc_sock,
  123. sk_list);
  124. svc_delete_socket(svsk);
  125. }
  126. if (serv->sv_shutdown)
  127. serv->sv_shutdown(serv);
  128. while (!list_empty(&serv->sv_permsocks)) {
  129. svsk = list_entry(serv->sv_permsocks.next,
  130. struct svc_sock,
  131. sk_list);
  132. svc_delete_socket(svsk);
  133. }
  134. cache_clean_deferred(serv);
  135. /* Unregister service with the portmapper */
  136. svc_register(serv, 0, 0);
  137. kfree(serv->sv_pools);
  138. kfree(serv);
  139. }
  140. /*
  141. * Allocate an RPC server's buffer space.
  142. * We allocate pages and place them in rq_argpages.
  143. */
  144. static int
  145. svc_init_buffer(struct svc_rqst *rqstp, unsigned int size)
  146. {
  147. int pages;
  148. int arghi;
  149. if (size > RPCSVC_MAXPAYLOAD)
  150. size = RPCSVC_MAXPAYLOAD;
  151. pages = 2 + (size+ PAGE_SIZE -1) / PAGE_SIZE;
  152. rqstp->rq_argused = 0;
  153. rqstp->rq_resused = 0;
  154. arghi = 0;
  155. BUG_ON(pages > RPCSVC_MAXPAGES);
  156. while (pages) {
  157. struct page *p = alloc_page(GFP_KERNEL);
  158. if (!p)
  159. break;
  160. rqstp->rq_argpages[arghi++] = p;
  161. pages--;
  162. }
  163. rqstp->rq_arghi = arghi;
  164. return ! pages;
  165. }
  166. /*
  167. * Release an RPC server buffer
  168. */
  169. static void
  170. svc_release_buffer(struct svc_rqst *rqstp)
  171. {
  172. while (rqstp->rq_arghi)
  173. put_page(rqstp->rq_argpages[--rqstp->rq_arghi]);
  174. while (rqstp->rq_resused) {
  175. if (rqstp->rq_respages[--rqstp->rq_resused] == NULL)
  176. continue;
  177. put_page(rqstp->rq_respages[rqstp->rq_resused]);
  178. }
  179. rqstp->rq_argused = 0;
  180. }
  181. /*
  182. * Create a thread in the given pool. Caller must hold BKL.
  183. */
  184. static int
  185. __svc_create_thread(svc_thread_fn func, struct svc_serv *serv,
  186. struct svc_pool *pool)
  187. {
  188. struct svc_rqst *rqstp;
  189. int error = -ENOMEM;
  190. rqstp = kzalloc(sizeof(*rqstp), GFP_KERNEL);
  191. if (!rqstp)
  192. goto out;
  193. init_waitqueue_head(&rqstp->rq_wait);
  194. if (!(rqstp->rq_argp = kmalloc(serv->sv_xdrsize, GFP_KERNEL))
  195. || !(rqstp->rq_resp = kmalloc(serv->sv_xdrsize, GFP_KERNEL))
  196. || !svc_init_buffer(rqstp, serv->sv_bufsz))
  197. goto out_thread;
  198. serv->sv_nrthreads++;
  199. spin_lock_bh(&pool->sp_lock);
  200. pool->sp_nrthreads++;
  201. list_add(&rqstp->rq_all, &pool->sp_all_threads);
  202. spin_unlock_bh(&pool->sp_lock);
  203. rqstp->rq_server = serv;
  204. rqstp->rq_pool = pool;
  205. error = kernel_thread((int (*)(void *)) func, rqstp, 0);
  206. if (error < 0)
  207. goto out_thread;
  208. svc_sock_update_bufs(serv);
  209. error = 0;
  210. out:
  211. return error;
  212. out_thread:
  213. svc_exit_thread(rqstp);
  214. goto out;
  215. }
  216. /*
  217. * Create a thread in the default pool. Caller must hold BKL.
  218. */
  219. int
  220. svc_create_thread(svc_thread_fn func, struct svc_serv *serv)
  221. {
  222. return __svc_create_thread(func, serv, &serv->sv_pools[0]);
  223. }
  224. /*
  225. * Choose a pool in which to create a new thread, for svc_set_num_threads
  226. */
  227. static inline struct svc_pool *
  228. choose_pool(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state)
  229. {
  230. if (pool != NULL)
  231. return pool;
  232. return &serv->sv_pools[(*state)++ % serv->sv_nrpools];
  233. }
  234. /*
  235. * Choose a thread to kill, for svc_set_num_threads
  236. */
  237. static inline struct task_struct *
  238. choose_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state)
  239. {
  240. unsigned int i;
  241. struct task_struct *task = NULL;
  242. if (pool != NULL) {
  243. spin_lock_bh(&pool->sp_lock);
  244. } else {
  245. /* choose a pool in round-robin fashion */
  246. for (i = 0; i < serv->sv_nrpools; i++) {
  247. pool = &serv->sv_pools[--(*state) % serv->sv_nrpools];
  248. spin_lock_bh(&pool->sp_lock);
  249. if (!list_empty(&pool->sp_all_threads))
  250. goto found_pool;
  251. spin_unlock_bh(&pool->sp_lock);
  252. }
  253. return NULL;
  254. }
  255. found_pool:
  256. if (!list_empty(&pool->sp_all_threads)) {
  257. struct svc_rqst *rqstp;
  258. /*
  259. * Remove from the pool->sp_all_threads list
  260. * so we don't try to kill it again.
  261. */
  262. rqstp = list_entry(pool->sp_all_threads.next, struct svc_rqst, rq_all);
  263. list_del_init(&rqstp->rq_all);
  264. task = rqstp->rq_task;
  265. }
  266. spin_unlock_bh(&pool->sp_lock);
  267. return task;
  268. }
  269. /*
  270. * Create or destroy enough new threads to make the number
  271. * of threads the given number. If `pool' is non-NULL, applies
  272. * only to threads in that pool, otherwise round-robins between
  273. * all pools. Must be called with a svc_get() reference and
  274. * the BKL held.
  275. *
  276. * Destroying threads relies on the service threads filling in
  277. * rqstp->rq_task, which only the nfs ones do. Assumes the serv
  278. * has been created using svc_create_pooled().
  279. *
  280. * Based on code that used to be in nfsd_svc() but tweaked
  281. * to be pool-aware.
  282. */
  283. int
  284. svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
  285. {
  286. struct task_struct *victim;
  287. int error = 0;
  288. unsigned int state = serv->sv_nrthreads-1;
  289. if (pool == NULL) {
  290. /* The -1 assumes caller has done a svc_get() */
  291. nrservs -= (serv->sv_nrthreads-1);
  292. } else {
  293. spin_lock_bh(&pool->sp_lock);
  294. nrservs -= pool->sp_nrthreads;
  295. spin_unlock_bh(&pool->sp_lock);
  296. }
  297. /* create new threads */
  298. while (nrservs > 0) {
  299. nrservs--;
  300. __module_get(serv->sv_module);
  301. error = __svc_create_thread(serv->sv_function, serv,
  302. choose_pool(serv, pool, &state));
  303. if (error < 0) {
  304. module_put(serv->sv_module);
  305. break;
  306. }
  307. }
  308. /* destroy old threads */
  309. while (nrservs < 0 &&
  310. (victim = choose_victim(serv, pool, &state)) != NULL) {
  311. send_sig(serv->sv_kill_signal, victim, 1);
  312. nrservs++;
  313. }
  314. return error;
  315. }
  316. /*
  317. * Called from a server thread as it's exiting. Caller must hold BKL.
  318. */
  319. void
  320. svc_exit_thread(struct svc_rqst *rqstp)
  321. {
  322. struct svc_serv *serv = rqstp->rq_server;
  323. struct svc_pool *pool = rqstp->rq_pool;
  324. svc_release_buffer(rqstp);
  325. kfree(rqstp->rq_resp);
  326. kfree(rqstp->rq_argp);
  327. kfree(rqstp->rq_auth_data);
  328. spin_lock_bh(&pool->sp_lock);
  329. pool->sp_nrthreads--;
  330. list_del(&rqstp->rq_all);
  331. spin_unlock_bh(&pool->sp_lock);
  332. kfree(rqstp);
  333. /* Release the server */
  334. if (serv)
  335. svc_destroy(serv);
  336. }
  337. /*
  338. * Register an RPC service with the local portmapper.
  339. * To unregister a service, call this routine with
  340. * proto and port == 0.
  341. */
  342. int
  343. svc_register(struct svc_serv *serv, int proto, unsigned short port)
  344. {
  345. struct svc_program *progp;
  346. unsigned long flags;
  347. int i, error = 0, dummy;
  348. progp = serv->sv_program;
  349. dprintk("RPC: svc_register(%s, %s, %d)\n",
  350. progp->pg_name, proto == IPPROTO_UDP? "udp" : "tcp", port);
  351. if (!port)
  352. clear_thread_flag(TIF_SIGPENDING);
  353. for (i = 0; i < progp->pg_nvers; i++) {
  354. if (progp->pg_vers[i] == NULL)
  355. continue;
  356. error = rpc_register(progp->pg_prog, i, proto, port, &dummy);
  357. if (error < 0)
  358. break;
  359. if (port && !dummy) {
  360. error = -EACCES;
  361. break;
  362. }
  363. }
  364. if (!port) {
  365. spin_lock_irqsave(&current->sighand->siglock, flags);
  366. recalc_sigpending();
  367. spin_unlock_irqrestore(&current->sighand->siglock, flags);
  368. }
  369. return error;
  370. }
  371. /*
  372. * Process the RPC request.
  373. */
  374. int
  375. svc_process(struct svc_rqst *rqstp)
  376. {
  377. struct svc_program *progp;
  378. struct svc_version *versp = NULL; /* compiler food */
  379. struct svc_procedure *procp = NULL;
  380. struct kvec * argv = &rqstp->rq_arg.head[0];
  381. struct kvec * resv = &rqstp->rq_res.head[0];
  382. struct svc_serv *serv = rqstp->rq_server;
  383. kxdrproc_t xdr;
  384. __be32 *statp;
  385. u32 dir, prog, vers, proc;
  386. __be32 auth_stat, rpc_stat;
  387. int auth_res;
  388. __be32 *accept_statp;
  389. rpc_stat = rpc_success;
  390. if (argv->iov_len < 6*4)
  391. goto err_short_len;
  392. /* setup response xdr_buf.
  393. * Initially it has just one page
  394. */
  395. svc_take_page(rqstp); /* must succeed */
  396. resv->iov_base = page_address(rqstp->rq_respages[0]);
  397. resv->iov_len = 0;
  398. rqstp->rq_res.pages = rqstp->rq_respages+1;
  399. rqstp->rq_res.len = 0;
  400. rqstp->rq_res.page_base = 0;
  401. rqstp->rq_res.page_len = 0;
  402. rqstp->rq_res.buflen = PAGE_SIZE;
  403. rqstp->rq_res.tail[0].iov_base = NULL;
  404. rqstp->rq_res.tail[0].iov_len = 0;
  405. /* Will be turned off only in gss privacy case: */
  406. rqstp->rq_sendfile_ok = 1;
  407. /* tcp needs a space for the record length... */
  408. if (rqstp->rq_prot == IPPROTO_TCP)
  409. svc_putnl(resv, 0);
  410. rqstp->rq_xid = svc_getu32(argv);
  411. svc_putu32(resv, rqstp->rq_xid);
  412. dir = svc_getnl(argv);
  413. vers = svc_getnl(argv);
  414. /* First words of reply: */
  415. svc_putnl(resv, 1); /* REPLY */
  416. if (dir != 0) /* direction != CALL */
  417. goto err_bad_dir;
  418. if (vers != 2) /* RPC version number */
  419. goto err_bad_rpc;
  420. /* Save position in case we later decide to reject: */
  421. accept_statp = resv->iov_base + resv->iov_len;
  422. svc_putnl(resv, 0); /* ACCEPT */
  423. rqstp->rq_prog = prog = svc_getnl(argv); /* program number */
  424. rqstp->rq_vers = vers = svc_getnl(argv); /* version number */
  425. rqstp->rq_proc = proc = svc_getnl(argv); /* procedure number */
  426. progp = serv->sv_program;
  427. for (progp = serv->sv_program; progp; progp = progp->pg_next)
  428. if (prog == progp->pg_prog)
  429. break;
  430. /*
  431. * Decode auth data, and add verifier to reply buffer.
  432. * We do this before anything else in order to get a decent
  433. * auth verifier.
  434. */
  435. auth_res = svc_authenticate(rqstp, &auth_stat);
  436. /* Also give the program a chance to reject this call: */
  437. if (auth_res == SVC_OK && progp) {
  438. auth_stat = rpc_autherr_badcred;
  439. auth_res = progp->pg_authenticate(rqstp);
  440. }
  441. switch (auth_res) {
  442. case SVC_OK:
  443. break;
  444. case SVC_GARBAGE:
  445. rpc_stat = rpc_garbage_args;
  446. goto err_bad;
  447. case SVC_SYSERR:
  448. rpc_stat = rpc_system_err;
  449. goto err_bad;
  450. case SVC_DENIED:
  451. goto err_bad_auth;
  452. case SVC_DROP:
  453. goto dropit;
  454. case SVC_COMPLETE:
  455. goto sendit;
  456. }
  457. if (progp == NULL)
  458. goto err_bad_prog;
  459. if (vers >= progp->pg_nvers ||
  460. !(versp = progp->pg_vers[vers]))
  461. goto err_bad_vers;
  462. procp = versp->vs_proc + proc;
  463. if (proc >= versp->vs_nproc || !procp->pc_func)
  464. goto err_bad_proc;
  465. rqstp->rq_server = serv;
  466. rqstp->rq_procinfo = procp;
  467. /* Syntactic check complete */
  468. serv->sv_stats->rpccnt++;
  469. /* Build the reply header. */
  470. statp = resv->iov_base +resv->iov_len;
  471. svc_putnl(resv, RPC_SUCCESS);
  472. /* Bump per-procedure stats counter */
  473. procp->pc_count++;
  474. /* Initialize storage for argp and resp */
  475. memset(rqstp->rq_argp, 0, procp->pc_argsize);
  476. memset(rqstp->rq_resp, 0, procp->pc_ressize);
  477. /* un-reserve some of the out-queue now that we have a
  478. * better idea of reply size
  479. */
  480. if (procp->pc_xdrressize)
  481. svc_reserve(rqstp, procp->pc_xdrressize<<2);
  482. /* Call the function that processes the request. */
  483. if (!versp->vs_dispatch) {
  484. /* Decode arguments */
  485. xdr = procp->pc_decode;
  486. if (xdr && !xdr(rqstp, argv->iov_base, rqstp->rq_argp))
  487. goto err_garbage;
  488. *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
  489. /* Encode reply */
  490. if (*statp == rpc_success && (xdr = procp->pc_encode)
  491. && !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
  492. dprintk("svc: failed to encode reply\n");
  493. /* serv->sv_stats->rpcsystemerr++; */
  494. *statp = rpc_system_err;
  495. }
  496. } else {
  497. dprintk("svc: calling dispatcher\n");
  498. if (!versp->vs_dispatch(rqstp, statp)) {
  499. /* Release reply info */
  500. if (procp->pc_release)
  501. procp->pc_release(rqstp, NULL, rqstp->rq_resp);
  502. goto dropit;
  503. }
  504. }
  505. /* Check RPC status result */
  506. if (*statp != rpc_success)
  507. resv->iov_len = ((void*)statp) - resv->iov_base + 4;
  508. /* Release reply info */
  509. if (procp->pc_release)
  510. procp->pc_release(rqstp, NULL, rqstp->rq_resp);
  511. if (procp->pc_encode == NULL)
  512. goto dropit;
  513. sendit:
  514. if (svc_authorise(rqstp))
  515. goto dropit;
  516. return svc_send(rqstp);
  517. dropit:
  518. svc_authorise(rqstp); /* doesn't hurt to call this twice */
  519. dprintk("svc: svc_process dropit\n");
  520. svc_drop(rqstp);
  521. return 0;
  522. err_short_len:
  523. #ifdef RPC_PARANOIA
  524. printk("svc: short len %Zd, dropping request\n", argv->iov_len);
  525. #endif
  526. goto dropit; /* drop request */
  527. err_bad_dir:
  528. #ifdef RPC_PARANOIA
  529. printk("svc: bad direction %d, dropping request\n", dir);
  530. #endif
  531. serv->sv_stats->rpcbadfmt++;
  532. goto dropit; /* drop request */
  533. err_bad_rpc:
  534. serv->sv_stats->rpcbadfmt++;
  535. svc_putnl(resv, 1); /* REJECT */
  536. svc_putnl(resv, 0); /* RPC_MISMATCH */
  537. svc_putnl(resv, 2); /* Only RPCv2 supported */
  538. svc_putnl(resv, 2);
  539. goto sendit;
  540. err_bad_auth:
  541. dprintk("svc: authentication failed (%d)\n", ntohl(auth_stat));
  542. serv->sv_stats->rpcbadauth++;
  543. /* Restore write pointer to location of accept status: */
  544. xdr_ressize_check(rqstp, accept_statp);
  545. svc_putnl(resv, 1); /* REJECT */
  546. svc_putnl(resv, 1); /* AUTH_ERROR */
  547. svc_putnl(resv, ntohl(auth_stat)); /* status */
  548. goto sendit;
  549. err_bad_prog:
  550. dprintk("svc: unknown program %d\n", prog);
  551. serv->sv_stats->rpcbadfmt++;
  552. svc_putnl(resv, RPC_PROG_UNAVAIL);
  553. goto sendit;
  554. err_bad_vers:
  555. #ifdef RPC_PARANOIA
  556. printk("svc: unknown version (%d)\n", vers);
  557. #endif
  558. serv->sv_stats->rpcbadfmt++;
  559. svc_putnl(resv, RPC_PROG_MISMATCH);
  560. svc_putnl(resv, progp->pg_lovers);
  561. svc_putnl(resv, progp->pg_hivers);
  562. goto sendit;
  563. err_bad_proc:
  564. #ifdef RPC_PARANOIA
  565. printk("svc: unknown procedure (%d)\n", proc);
  566. #endif
  567. serv->sv_stats->rpcbadfmt++;
  568. svc_putnl(resv, RPC_PROC_UNAVAIL);
  569. goto sendit;
  570. err_garbage:
  571. #ifdef RPC_PARANOIA
  572. printk("svc: failed to decode args\n");
  573. #endif
  574. rpc_stat = rpc_garbage_args;
  575. err_bad:
  576. serv->sv_stats->rpcbadfmt++;
  577. svc_putnl(resv, ntohl(rpc_stat));
  578. goto sendit;
  579. }