nfssvc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. /*
  2. * Central processing for nfsd.
  3. *
  4. * Authors: Olaf Kirch (okir@monad.swb.de)
  5. *
  6. * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #include <linux/sched.h>
  9. #include <linux/freezer.h>
  10. #include <linux/fs_struct.h>
  11. #include <linux/swap.h>
  12. #include <linux/sunrpc/stats.h>
  13. #include <linux/sunrpc/svcsock.h>
  14. #include <linux/lockd/bind.h>
  15. #include <linux/nfsacl.h>
  16. #include <linux/seq_file.h>
  17. #include "nfsd.h"
  18. #include "cache.h"
  19. #include "vfs.h"
  20. #define NFSDDBG_FACILITY NFSDDBG_SVC
  21. extern struct svc_program nfsd_program;
  22. static int nfsd(void *vrqstp);
  23. struct timeval nfssvc_boot;
  24. /*
  25. * nfsd_mutex protects nfsd_serv -- both the pointer itself and the members
  26. * of the svc_serv struct. In particular, ->sv_nrthreads but also to some
  27. * extent ->sv_temp_socks and ->sv_permsocks. It also protects nfsdstats.th_cnt
  28. *
  29. * If (out side the lock) nfsd_serv is non-NULL, then it must point to a
  30. * properly initialised 'struct svc_serv' with ->sv_nrthreads > 0. That number
  31. * of nfsd threads must exist and each must listed in ->sp_all_threads in each
  32. * entry of ->sv_pools[].
  33. *
  34. * Transitions of the thread count between zero and non-zero are of particular
  35. * interest since the svc_serv needs to be created and initialized at that
  36. * point, or freed.
  37. *
  38. * Finally, the nfsd_mutex also protects some of the global variables that are
  39. * accessed when nfsd starts and that are settable via the write_* routines in
  40. * nfsctl.c. In particular:
  41. *
  42. * user_recovery_dirname
  43. * user_lease_time
  44. * nfsd_versions
  45. */
  46. DEFINE_MUTEX(nfsd_mutex);
  47. struct svc_serv *nfsd_serv;
  48. /*
  49. * nfsd_drc_lock protects nfsd_drc_max_pages and nfsd_drc_pages_used.
  50. * nfsd_drc_max_pages limits the total amount of memory available for
  51. * version 4.1 DRC caches.
  52. * nfsd_drc_pages_used tracks the current version 4.1 DRC memory usage.
  53. */
  54. spinlock_t nfsd_drc_lock;
  55. unsigned int nfsd_drc_max_mem;
  56. unsigned int nfsd_drc_mem_used;
  57. #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
  58. static struct svc_stat nfsd_acl_svcstats;
  59. static struct svc_version * nfsd_acl_version[] = {
  60. [2] = &nfsd_acl_version2,
  61. [3] = &nfsd_acl_version3,
  62. };
  63. #define NFSD_ACL_MINVERS 2
  64. #define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version)
  65. static struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS];
  66. static struct svc_program nfsd_acl_program = {
  67. .pg_prog = NFS_ACL_PROGRAM,
  68. .pg_nvers = NFSD_ACL_NRVERS,
  69. .pg_vers = nfsd_acl_versions,
  70. .pg_name = "nfsacl",
  71. .pg_class = "nfsd",
  72. .pg_stats = &nfsd_acl_svcstats,
  73. .pg_authenticate = &svc_set_client,
  74. };
  75. static struct svc_stat nfsd_acl_svcstats = {
  76. .program = &nfsd_acl_program,
  77. };
  78. #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */
  79. static struct svc_version * nfsd_version[] = {
  80. [2] = &nfsd_version2,
  81. #if defined(CONFIG_NFSD_V3)
  82. [3] = &nfsd_version3,
  83. #endif
  84. #if defined(CONFIG_NFSD_V4)
  85. [4] = &nfsd_version4,
  86. #endif
  87. };
  88. #define NFSD_MINVERS 2
  89. #define NFSD_NRVERS ARRAY_SIZE(nfsd_version)
  90. static struct svc_version *nfsd_versions[NFSD_NRVERS];
  91. struct svc_program nfsd_program = {
  92. #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
  93. .pg_next = &nfsd_acl_program,
  94. #endif
  95. .pg_prog = NFS_PROGRAM, /* program number */
  96. .pg_nvers = NFSD_NRVERS, /* nr of entries in nfsd_version */
  97. .pg_vers = nfsd_versions, /* version table */
  98. .pg_name = "nfsd", /* program name */
  99. .pg_class = "nfsd", /* authentication class */
  100. .pg_stats = &nfsd_svcstats, /* version table */
  101. .pg_authenticate = &svc_set_client, /* export authentication */
  102. };
  103. u32 nfsd_supported_minorversion;
  104. int nfsd_vers(int vers, enum vers_op change)
  105. {
  106. if (vers < NFSD_MINVERS || vers >= NFSD_NRVERS)
  107. return 0;
  108. switch(change) {
  109. case NFSD_SET:
  110. nfsd_versions[vers] = nfsd_version[vers];
  111. #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
  112. if (vers < NFSD_ACL_NRVERS)
  113. nfsd_acl_versions[vers] = nfsd_acl_version[vers];
  114. #endif
  115. break;
  116. case NFSD_CLEAR:
  117. nfsd_versions[vers] = NULL;
  118. #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
  119. if (vers < NFSD_ACL_NRVERS)
  120. nfsd_acl_versions[vers] = NULL;
  121. #endif
  122. break;
  123. case NFSD_TEST:
  124. return nfsd_versions[vers] != NULL;
  125. case NFSD_AVAIL:
  126. return nfsd_version[vers] != NULL;
  127. }
  128. return 0;
  129. }
  130. int nfsd_minorversion(u32 minorversion, enum vers_op change)
  131. {
  132. if (minorversion > NFSD_SUPPORTED_MINOR_VERSION)
  133. return -1;
  134. switch(change) {
  135. case NFSD_SET:
  136. nfsd_supported_minorversion = minorversion;
  137. break;
  138. case NFSD_CLEAR:
  139. if (minorversion == 0)
  140. return -1;
  141. nfsd_supported_minorversion = minorversion - 1;
  142. break;
  143. case NFSD_TEST:
  144. return minorversion <= nfsd_supported_minorversion;
  145. case NFSD_AVAIL:
  146. return minorversion <= NFSD_SUPPORTED_MINOR_VERSION;
  147. }
  148. return 0;
  149. }
  150. /*
  151. * Maximum number of nfsd processes
  152. */
  153. #define NFSD_MAXSERVS 8192
  154. int nfsd_nrthreads(void)
  155. {
  156. int rv = 0;
  157. mutex_lock(&nfsd_mutex);
  158. if (nfsd_serv)
  159. rv = nfsd_serv->sv_nrthreads;
  160. mutex_unlock(&nfsd_mutex);
  161. return rv;
  162. }
  163. static int nfsd_init_socks(int port)
  164. {
  165. int error;
  166. if (!list_empty(&nfsd_serv->sv_permsocks))
  167. return 0;
  168. error = svc_create_xprt(nfsd_serv, "udp", PF_INET, port,
  169. SVC_SOCK_DEFAULTS);
  170. if (error < 0)
  171. return error;
  172. error = svc_create_xprt(nfsd_serv, "tcp", PF_INET, port,
  173. SVC_SOCK_DEFAULTS);
  174. if (error < 0)
  175. return error;
  176. return 0;
  177. }
  178. static bool nfsd_up = false;
  179. static int nfsd_startup(unsigned short port, int nrservs)
  180. {
  181. int ret;
  182. /*
  183. * Readahead param cache - will no-op if it already exists.
  184. * (Note therefore results will be suboptimal if number of
  185. * threads is modified after nfsd start.)
  186. */
  187. ret = nfsd_racache_init(2*nrservs);
  188. if (ret)
  189. return ret;
  190. ret = nfsd_init_socks(port);
  191. if (ret)
  192. goto out_racache;
  193. ret = lockd_up();
  194. if (ret)
  195. return ret;
  196. ret = nfs4_state_start();
  197. if (ret)
  198. goto out_lockd;
  199. nfsd_reset_versions();
  200. nfsd_up = true;
  201. return 0;
  202. out_lockd:
  203. lockd_down();
  204. out_racache:
  205. nfsd_racache_shutdown();
  206. return ret;
  207. }
  208. static void nfsd_shutdown(void)
  209. {
  210. /*
  211. * write_ports can create the server without actually starting
  212. * any threads--if we get shut down before any threads are
  213. * started, then nfsd_last_thread will be run before any of this
  214. * other initialization has been done.
  215. */
  216. if (!nfsd_up)
  217. return;
  218. nfs4_state_shutdown();
  219. lockd_down();
  220. nfsd_racache_shutdown();
  221. nfsd_up = false;
  222. }
  223. static void nfsd_last_thread(struct svc_serv *serv)
  224. {
  225. /* When last nfsd thread exits we need to do some clean-up */
  226. nfsd_serv = NULL;
  227. nfsd_shutdown();
  228. printk(KERN_WARNING "nfsd: last server has exited, flushing export "
  229. "cache\n");
  230. nfsd_export_flush();
  231. }
  232. void nfsd_reset_versions(void)
  233. {
  234. int found_one = 0;
  235. int i;
  236. for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) {
  237. if (nfsd_program.pg_vers[i])
  238. found_one = 1;
  239. }
  240. if (!found_one) {
  241. for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++)
  242. nfsd_program.pg_vers[i] = nfsd_version[i];
  243. #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
  244. for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++)
  245. nfsd_acl_program.pg_vers[i] =
  246. nfsd_acl_version[i];
  247. #endif
  248. }
  249. }
  250. /*
  251. * Each session guarantees a negotiated per slot memory cache for replies
  252. * which in turn consumes memory beyond the v2/v3/v4.0 server. A dedicated
  253. * NFSv4.1 server might want to use more memory for a DRC than a machine
  254. * with mutiple services.
  255. *
  256. * Impose a hard limit on the number of pages for the DRC which varies
  257. * according to the machines free pages. This is of course only a default.
  258. *
  259. * For now this is a #defined shift which could be under admin control
  260. * in the future.
  261. */
  262. static void set_max_drc(void)
  263. {
  264. #define NFSD_DRC_SIZE_SHIFT 10
  265. nfsd_drc_max_mem = (nr_free_buffer_pages()
  266. >> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE;
  267. nfsd_drc_mem_used = 0;
  268. spin_lock_init(&nfsd_drc_lock);
  269. dprintk("%s nfsd_drc_max_mem %u \n", __func__, nfsd_drc_max_mem);
  270. }
  271. int nfsd_create_serv(void)
  272. {
  273. int err = 0;
  274. WARN_ON(!mutex_is_locked(&nfsd_mutex));
  275. if (nfsd_serv) {
  276. svc_get(nfsd_serv);
  277. return 0;
  278. }
  279. if (nfsd_max_blksize == 0) {
  280. /* choose a suitable default */
  281. struct sysinfo i;
  282. si_meminfo(&i);
  283. /* Aim for 1/4096 of memory per thread
  284. * This gives 1MB on 4Gig machines
  285. * But only uses 32K on 128M machines.
  286. * Bottom out at 8K on 32M and smaller.
  287. * Of course, this is only a default.
  288. */
  289. nfsd_max_blksize = NFSSVC_MAXBLKSIZE;
  290. i.totalram <<= PAGE_SHIFT - 12;
  291. while (nfsd_max_blksize > i.totalram &&
  292. nfsd_max_blksize >= 8*1024*2)
  293. nfsd_max_blksize /= 2;
  294. }
  295. nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
  296. nfsd_last_thread, nfsd, THIS_MODULE);
  297. if (nfsd_serv == NULL)
  298. return -ENOMEM;
  299. set_max_drc();
  300. do_gettimeofday(&nfssvc_boot); /* record boot time */
  301. return err;
  302. }
  303. int nfsd_nrpools(void)
  304. {
  305. if (nfsd_serv == NULL)
  306. return 0;
  307. else
  308. return nfsd_serv->sv_nrpools;
  309. }
  310. int nfsd_get_nrthreads(int n, int *nthreads)
  311. {
  312. int i = 0;
  313. if (nfsd_serv != NULL) {
  314. for (i = 0; i < nfsd_serv->sv_nrpools && i < n; i++)
  315. nthreads[i] = nfsd_serv->sv_pools[i].sp_nrthreads;
  316. }
  317. return 0;
  318. }
  319. int nfsd_set_nrthreads(int n, int *nthreads)
  320. {
  321. int i = 0;
  322. int tot = 0;
  323. int err = 0;
  324. WARN_ON(!mutex_is_locked(&nfsd_mutex));
  325. if (nfsd_serv == NULL || n <= 0)
  326. return 0;
  327. if (n > nfsd_serv->sv_nrpools)
  328. n = nfsd_serv->sv_nrpools;
  329. /* enforce a global maximum number of threads */
  330. tot = 0;
  331. for (i = 0; i < n; i++) {
  332. if (nthreads[i] > NFSD_MAXSERVS)
  333. nthreads[i] = NFSD_MAXSERVS;
  334. tot += nthreads[i];
  335. }
  336. if (tot > NFSD_MAXSERVS) {
  337. /* total too large: scale down requested numbers */
  338. for (i = 0; i < n && tot > 0; i++) {
  339. int new = nthreads[i] * NFSD_MAXSERVS / tot;
  340. tot -= (nthreads[i] - new);
  341. nthreads[i] = new;
  342. }
  343. for (i = 0; i < n && tot > 0; i++) {
  344. nthreads[i]--;
  345. tot--;
  346. }
  347. }
  348. /*
  349. * There must always be a thread in pool 0; the admin
  350. * can't shut down NFS completely using pool_threads.
  351. */
  352. if (nthreads[0] == 0)
  353. nthreads[0] = 1;
  354. /* apply the new numbers */
  355. svc_get(nfsd_serv);
  356. for (i = 0; i < n; i++) {
  357. err = svc_set_num_threads(nfsd_serv, &nfsd_serv->sv_pools[i],
  358. nthreads[i]);
  359. if (err)
  360. break;
  361. }
  362. svc_destroy(nfsd_serv);
  363. return err;
  364. }
  365. /*
  366. * Adjust the number of threads and return the new number of threads.
  367. * This is also the function that starts the server if necessary, if
  368. * this is the first time nrservs is nonzero.
  369. */
  370. int
  371. nfsd_svc(unsigned short port, int nrservs)
  372. {
  373. int error;
  374. bool first_thread;
  375. mutex_lock(&nfsd_mutex);
  376. dprintk("nfsd: creating service\n");
  377. if (nrservs <= 0)
  378. nrservs = 0;
  379. if (nrservs > NFSD_MAXSERVS)
  380. nrservs = NFSD_MAXSERVS;
  381. error = 0;
  382. if (nrservs == 0 && nfsd_serv == NULL)
  383. goto out;
  384. first_thread = (nfsd_serv->sv_nrthreads == 0) && (nrservs != 0);
  385. if (first_thread) {
  386. error = nfsd_startup(port, nrservs);
  387. if (error)
  388. goto out;
  389. }
  390. error = nfsd_create_serv();
  391. if (error)
  392. goto out_shutdown;
  393. error = svc_set_num_threads(nfsd_serv, NULL, nrservs);
  394. if (error == 0)
  395. /* We are holding a reference to nfsd_serv which
  396. * we don't want to count in the return value,
  397. * so subtract 1
  398. */
  399. error = nfsd_serv->sv_nrthreads - 1;
  400. out_destroy:
  401. svc_destroy(nfsd_serv); /* Release server */
  402. out_shutdown:
  403. if (error < 0 && first_thread)
  404. nfsd_shutdown();
  405. out:
  406. mutex_unlock(&nfsd_mutex);
  407. return error;
  408. }
  409. /*
  410. * This is the NFS server kernel thread
  411. */
  412. static int
  413. nfsd(void *vrqstp)
  414. {
  415. struct svc_rqst *rqstp = (struct svc_rqst *) vrqstp;
  416. int err, preverr = 0;
  417. /* Lock module and set up kernel thread */
  418. mutex_lock(&nfsd_mutex);
  419. /* At this point, the thread shares current->fs
  420. * with the init process. We need to create files with a
  421. * umask of 0 instead of init's umask. */
  422. if (unshare_fs_struct() < 0) {
  423. printk("Unable to start nfsd thread: out of memory\n");
  424. goto out;
  425. }
  426. current->fs->umask = 0;
  427. /*
  428. * thread is spawned with all signals set to SIG_IGN, re-enable
  429. * the ones that will bring down the thread
  430. */
  431. allow_signal(SIGKILL);
  432. allow_signal(SIGHUP);
  433. allow_signal(SIGINT);
  434. allow_signal(SIGQUIT);
  435. nfsdstats.th_cnt++;
  436. mutex_unlock(&nfsd_mutex);
  437. /*
  438. * We want less throttling in balance_dirty_pages() so that nfs to
  439. * localhost doesn't cause nfsd to lock up due to all the client's
  440. * dirty pages.
  441. */
  442. current->flags |= PF_LESS_THROTTLE;
  443. set_freezable();
  444. /*
  445. * The main request loop
  446. */
  447. for (;;) {
  448. /*
  449. * Find a socket with data available and call its
  450. * recvfrom routine.
  451. */
  452. while ((err = svc_recv(rqstp, 60*60*HZ)) == -EAGAIN)
  453. ;
  454. if (err == -EINTR)
  455. break;
  456. else if (err < 0) {
  457. if (err != preverr) {
  458. printk(KERN_WARNING "%s: unexpected error "
  459. "from svc_recv (%d)\n", __func__, -err);
  460. preverr = err;
  461. }
  462. schedule_timeout_uninterruptible(HZ);
  463. continue;
  464. }
  465. /* Lock the export hash tables for reading. */
  466. exp_readlock();
  467. validate_process_creds();
  468. svc_process(rqstp);
  469. validate_process_creds();
  470. /* Unlock export hash tables */
  471. exp_readunlock();
  472. }
  473. /* Clear signals before calling svc_exit_thread() */
  474. flush_signals(current);
  475. mutex_lock(&nfsd_mutex);
  476. nfsdstats.th_cnt --;
  477. out:
  478. /* Release the thread */
  479. svc_exit_thread(rqstp);
  480. /* Release module */
  481. mutex_unlock(&nfsd_mutex);
  482. module_put_and_exit(0);
  483. return 0;
  484. }
  485. static __be32 map_new_errors(u32 vers, __be32 nfserr)
  486. {
  487. if (nfserr == nfserr_jukebox && vers == 2)
  488. return nfserr_dropit;
  489. if (nfserr == nfserr_wrongsec && vers < 4)
  490. return nfserr_acces;
  491. return nfserr;
  492. }
  493. int
  494. nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
  495. {
  496. struct svc_procedure *proc;
  497. kxdrproc_t xdr;
  498. __be32 nfserr;
  499. __be32 *nfserrp;
  500. dprintk("nfsd_dispatch: vers %d proc %d\n",
  501. rqstp->rq_vers, rqstp->rq_proc);
  502. proc = rqstp->rq_procinfo;
  503. /* Check whether we have this call in the cache. */
  504. switch (nfsd_cache_lookup(rqstp, proc->pc_cachetype)) {
  505. case RC_INTR:
  506. case RC_DROPIT:
  507. return 0;
  508. case RC_REPLY:
  509. return 1;
  510. case RC_DOIT:;
  511. /* do it */
  512. }
  513. /* Decode arguments */
  514. xdr = proc->pc_decode;
  515. if (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base,
  516. rqstp->rq_argp)) {
  517. dprintk("nfsd: failed to decode arguments!\n");
  518. nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
  519. *statp = rpc_garbage_args;
  520. return 1;
  521. }
  522. /* need to grab the location to store the status, as
  523. * nfsv4 does some encoding while processing
  524. */
  525. nfserrp = rqstp->rq_res.head[0].iov_base
  526. + rqstp->rq_res.head[0].iov_len;
  527. rqstp->rq_res.head[0].iov_len += sizeof(__be32);
  528. /* Now call the procedure handler, and encode NFS status. */
  529. nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
  530. nfserr = map_new_errors(rqstp->rq_vers, nfserr);
  531. if (nfserr == nfserr_dropit) {
  532. dprintk("nfsd: Dropping request; may be revisited later\n");
  533. nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
  534. return 0;
  535. }
  536. if (rqstp->rq_proc != 0)
  537. *nfserrp++ = nfserr;
  538. /* Encode result.
  539. * For NFSv2, additional info is never returned in case of an error.
  540. */
  541. if (!(nfserr && rqstp->rq_vers == 2)) {
  542. xdr = proc->pc_encode;
  543. if (xdr && !xdr(rqstp, nfserrp,
  544. rqstp->rq_resp)) {
  545. /* Failed to encode result. Release cache entry */
  546. dprintk("nfsd: failed to encode result!\n");
  547. nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
  548. *statp = rpc_system_err;
  549. return 1;
  550. }
  551. }
  552. /* Store reply in cache. */
  553. nfsd_cache_update(rqstp, proc->pc_cachetype, statp + 1);
  554. return 1;
  555. }
  556. int nfsd_pool_stats_open(struct inode *inode, struct file *file)
  557. {
  558. int ret;
  559. mutex_lock(&nfsd_mutex);
  560. if (nfsd_serv == NULL) {
  561. mutex_unlock(&nfsd_mutex);
  562. return -ENODEV;
  563. }
  564. /* bump up the psudo refcount while traversing */
  565. svc_get(nfsd_serv);
  566. ret = svc_pool_stats_open(nfsd_serv, file);
  567. mutex_unlock(&nfsd_mutex);
  568. return ret;
  569. }
  570. int nfsd_pool_stats_release(struct inode *inode, struct file *file)
  571. {
  572. int ret = seq_release(inode, file);
  573. mutex_lock(&nfsd_mutex);
  574. /* this function really, really should have been called svc_put() */
  575. svc_destroy(nfsd_serv);
  576. mutex_unlock(&nfsd_mutex);
  577. return ret;
  578. }