nfs4proc.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171
  1. /*
  2. * fs/nfsd/nfs4proc.c
  3. *
  4. * Server-side procedures for NFSv4.
  5. *
  6. * Copyright (c) 2002 The Regents of the University of Michigan.
  7. * All rights reserved.
  8. *
  9. * Kendrick Smith <kmsmith@umich.edu>
  10. * Andy Adamson <andros@umich.edu>
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * 1. Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. * 2. Redistributions in binary form must reproduce the above copyright
  19. * notice, this list of conditions and the following disclaimer in the
  20. * documentation and/or other materials provided with the distribution.
  21. * 3. Neither the name of the University nor the names of its
  22. * contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  26. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  27. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  28. * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  30. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  31. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  32. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  33. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  34. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  35. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #include <linux/param.h>
  38. #include <linux/major.h>
  39. #include <linux/slab.h>
  40. #include <linux/file.h>
  41. #include <linux/sunrpc/svc.h>
  42. #include <linux/nfsd/nfsd.h>
  43. #include <linux/nfsd/cache.h>
  44. #include <linux/nfs4.h>
  45. #include <linux/nfsd/state.h>
  46. #include <linux/nfsd/xdr4.h>
  47. #include <linux/nfs4_acl.h>
  48. #include <linux/sunrpc/gss_api.h>
  49. #define NFSDDBG_FACILITY NFSDDBG_PROC
  50. static inline void
  51. fh_dup2(struct svc_fh *dst, struct svc_fh *src)
  52. {
  53. fh_put(dst);
  54. dget(src->fh_dentry);
  55. if (src->fh_export)
  56. cache_get(&src->fh_export->h);
  57. *dst = *src;
  58. }
  59. static __be32
  60. do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
  61. {
  62. __be32 status;
  63. if (open->op_truncate &&
  64. !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
  65. return nfserr_inval;
  66. if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
  67. accmode |= NFSD_MAY_READ;
  68. if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
  69. accmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC);
  70. if (open->op_share_deny & NFS4_SHARE_DENY_WRITE)
  71. accmode |= NFSD_MAY_WRITE;
  72. status = fh_verify(rqstp, current_fh, S_IFREG, accmode);
  73. return status;
  74. }
  75. static __be32
  76. do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
  77. {
  78. struct svc_fh resfh;
  79. __be32 status;
  80. int created = 0;
  81. fh_init(&resfh, NFS4_FHSIZE);
  82. open->op_truncate = 0;
  83. if (open->op_create) {
  84. /*
  85. * Note: create modes (UNCHECKED,GUARDED...) are the same
  86. * in NFSv4 as in v3.
  87. */
  88. status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data,
  89. open->op_fname.len, &open->op_iattr,
  90. &resfh, open->op_createmode,
  91. (u32 *)open->op_verf.data,
  92. &open->op_truncate, &created);
  93. /* If we ever decide to use different attrs to store the
  94. * verifier in nfsd_create_v3, then we'll need to change this
  95. */
  96. if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
  97. open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |
  98. FATTR4_WORD1_TIME_MODIFY);
  99. } else {
  100. status = nfsd_lookup(rqstp, current_fh,
  101. open->op_fname.data, open->op_fname.len, &resfh);
  102. fh_unlock(current_fh);
  103. }
  104. if (status)
  105. goto out;
  106. set_change_info(&open->op_cinfo, current_fh);
  107. /* set reply cache */
  108. fh_dup2(current_fh, &resfh);
  109. open->op_stateowner->so_replay.rp_openfh_len = resfh.fh_handle.fh_size;
  110. memcpy(open->op_stateowner->so_replay.rp_openfh,
  111. &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size);
  112. if (!created)
  113. status = do_open_permission(rqstp, current_fh, open,
  114. NFSD_MAY_NOP);
  115. out:
  116. fh_put(&resfh);
  117. return status;
  118. }
  119. static __be32
  120. do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
  121. {
  122. __be32 status;
  123. /* Only reclaims from previously confirmed clients are valid */
  124. if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
  125. return status;
  126. /* We don't know the target directory, and therefore can not
  127. * set the change info
  128. */
  129. memset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));
  130. /* set replay cache */
  131. open->op_stateowner->so_replay.rp_openfh_len = current_fh->fh_handle.fh_size;
  132. memcpy(open->op_stateowner->so_replay.rp_openfh,
  133. &current_fh->fh_handle.fh_base,
  134. current_fh->fh_handle.fh_size);
  135. open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
  136. (open->op_iattr.ia_size == 0);
  137. status = do_open_permission(rqstp, current_fh, open,
  138. NFSD_MAY_OWNER_OVERRIDE);
  139. return status;
  140. }
  141. static __be32
  142. nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  143. struct nfsd4_open *open)
  144. {
  145. __be32 status;
  146. dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
  147. (int)open->op_fname.len, open->op_fname.data,
  148. open->op_stateowner);
  149. /* This check required by spec. */
  150. if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
  151. return nfserr_inval;
  152. nfs4_lock_state();
  153. /* check seqid for replay. set nfs4_owner */
  154. status = nfsd4_process_open1(open);
  155. if (status == nfserr_replay_me) {
  156. struct nfs4_replay *rp = &open->op_stateowner->so_replay;
  157. fh_put(&cstate->current_fh);
  158. cstate->current_fh.fh_handle.fh_size = rp->rp_openfh_len;
  159. memcpy(&cstate->current_fh.fh_handle.fh_base, rp->rp_openfh,
  160. rp->rp_openfh_len);
  161. status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
  162. if (status)
  163. dprintk("nfsd4_open: replay failed"
  164. " restoring previous filehandle\n");
  165. else
  166. status = nfserr_replay_me;
  167. }
  168. if (status)
  169. goto out;
  170. /* Openowner is now set, so sequence id will get bumped. Now we need
  171. * these checks before we do any creates: */
  172. status = nfserr_grace;
  173. if (locks_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
  174. goto out;
  175. status = nfserr_no_grace;
  176. if (!locks_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
  177. goto out;
  178. switch (open->op_claim_type) {
  179. case NFS4_OPEN_CLAIM_DELEGATE_CUR:
  180. status = nfserr_inval;
  181. if (open->op_create)
  182. goto out;
  183. /* fall through */
  184. case NFS4_OPEN_CLAIM_NULL:
  185. /*
  186. * (1) set CURRENT_FH to the file being opened,
  187. * creating it if necessary, (2) set open->op_cinfo,
  188. * (3) set open->op_truncate if the file is to be
  189. * truncated after opening, (4) do permission checking.
  190. */
  191. status = do_open_lookup(rqstp, &cstate->current_fh,
  192. open);
  193. if (status)
  194. goto out;
  195. break;
  196. case NFS4_OPEN_CLAIM_PREVIOUS:
  197. open->op_stateowner->so_confirmed = 1;
  198. /*
  199. * The CURRENT_FH is already set to the file being
  200. * opened. (1) set open->op_cinfo, (2) set
  201. * open->op_truncate if the file is to be truncated
  202. * after opening, (3) do permission checking.
  203. */
  204. status = do_open_fhandle(rqstp, &cstate->current_fh,
  205. open);
  206. if (status)
  207. goto out;
  208. break;
  209. case NFS4_OPEN_CLAIM_DELEGATE_PREV:
  210. open->op_stateowner->so_confirmed = 1;
  211. dprintk("NFSD: unsupported OPEN claim type %d\n",
  212. open->op_claim_type);
  213. status = nfserr_notsupp;
  214. goto out;
  215. default:
  216. dprintk("NFSD: Invalid OPEN claim type %d\n",
  217. open->op_claim_type);
  218. status = nfserr_inval;
  219. goto out;
  220. }
  221. /*
  222. * nfsd4_process_open2() does the actual opening of the file. If
  223. * successful, it (1) truncates the file if open->op_truncate was
  224. * set, (2) sets open->op_stateid, (3) sets open->op_delegation.
  225. */
  226. status = nfsd4_process_open2(rqstp, &cstate->current_fh, open);
  227. out:
  228. if (open->op_stateowner) {
  229. nfs4_get_stateowner(open->op_stateowner);
  230. cstate->replay_owner = open->op_stateowner;
  231. }
  232. nfs4_unlock_state();
  233. return status;
  234. }
  235. /*
  236. * filehandle-manipulating ops.
  237. */
  238. static __be32
  239. nfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  240. struct svc_fh **getfh)
  241. {
  242. if (!cstate->current_fh.fh_dentry)
  243. return nfserr_nofilehandle;
  244. *getfh = &cstate->current_fh;
  245. return nfs_ok;
  246. }
  247. static __be32
  248. nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  249. struct nfsd4_putfh *putfh)
  250. {
  251. fh_put(&cstate->current_fh);
  252. cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;
  253. memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,
  254. putfh->pf_fhlen);
  255. return fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
  256. }
  257. static __be32
  258. nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  259. void *arg)
  260. {
  261. __be32 status;
  262. fh_put(&cstate->current_fh);
  263. status = exp_pseudoroot(rqstp, &cstate->current_fh);
  264. return status;
  265. }
  266. static __be32
  267. nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  268. void *arg)
  269. {
  270. if (!cstate->save_fh.fh_dentry)
  271. return nfserr_restorefh;
  272. fh_dup2(&cstate->current_fh, &cstate->save_fh);
  273. return nfs_ok;
  274. }
  275. static __be32
  276. nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  277. void *arg)
  278. {
  279. if (!cstate->current_fh.fh_dentry)
  280. return nfserr_nofilehandle;
  281. fh_dup2(&cstate->save_fh, &cstate->current_fh);
  282. return nfs_ok;
  283. }
  284. /*
  285. * misc nfsv4 ops
  286. */
  287. static __be32
  288. nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  289. struct nfsd4_access *access)
  290. {
  291. if (access->ac_req_access & ~NFS3_ACCESS_FULL)
  292. return nfserr_inval;
  293. access->ac_resp_access = access->ac_req_access;
  294. return nfsd_access(rqstp, &cstate->current_fh, &access->ac_resp_access,
  295. &access->ac_supported);
  296. }
  297. static __be32
  298. nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  299. struct nfsd4_commit *commit)
  300. {
  301. __be32 status;
  302. u32 *p = (u32 *)commit->co_verf.data;
  303. *p++ = nfssvc_boot.tv_sec;
  304. *p++ = nfssvc_boot.tv_usec;
  305. status = nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset,
  306. commit->co_count);
  307. if (status == nfserr_symlink)
  308. status = nfserr_inval;
  309. return status;
  310. }
  311. static __be32
  312. nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  313. struct nfsd4_create *create)
  314. {
  315. struct svc_fh resfh;
  316. __be32 status;
  317. dev_t rdev;
  318. fh_init(&resfh, NFS4_FHSIZE);
  319. status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR,
  320. NFSD_MAY_CREATE);
  321. if (status == nfserr_symlink)
  322. status = nfserr_notdir;
  323. if (status)
  324. return status;
  325. switch (create->cr_type) {
  326. case NF4LNK:
  327. /* ugh! we have to null-terminate the linktext, or
  328. * vfs_symlink() will choke. it is always safe to
  329. * null-terminate by brute force, since at worst we
  330. * will overwrite the first byte of the create namelen
  331. * in the XDR buffer, which has already been extracted
  332. * during XDR decode.
  333. */
  334. create->cr_linkname[create->cr_linklen] = 0;
  335. status = nfsd_symlink(rqstp, &cstate->current_fh,
  336. create->cr_name, create->cr_namelen,
  337. create->cr_linkname, create->cr_linklen,
  338. &resfh, &create->cr_iattr);
  339. break;
  340. case NF4BLK:
  341. rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
  342. if (MAJOR(rdev) != create->cr_specdata1 ||
  343. MINOR(rdev) != create->cr_specdata2)
  344. return nfserr_inval;
  345. status = nfsd_create(rqstp, &cstate->current_fh,
  346. create->cr_name, create->cr_namelen,
  347. &create->cr_iattr, S_IFBLK, rdev, &resfh);
  348. break;
  349. case NF4CHR:
  350. rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
  351. if (MAJOR(rdev) != create->cr_specdata1 ||
  352. MINOR(rdev) != create->cr_specdata2)
  353. return nfserr_inval;
  354. status = nfsd_create(rqstp, &cstate->current_fh,
  355. create->cr_name, create->cr_namelen,
  356. &create->cr_iattr,S_IFCHR, rdev, &resfh);
  357. break;
  358. case NF4SOCK:
  359. status = nfsd_create(rqstp, &cstate->current_fh,
  360. create->cr_name, create->cr_namelen,
  361. &create->cr_iattr, S_IFSOCK, 0, &resfh);
  362. break;
  363. case NF4FIFO:
  364. status = nfsd_create(rqstp, &cstate->current_fh,
  365. create->cr_name, create->cr_namelen,
  366. &create->cr_iattr, S_IFIFO, 0, &resfh);
  367. break;
  368. case NF4DIR:
  369. create->cr_iattr.ia_valid &= ~ATTR_SIZE;
  370. status = nfsd_create(rqstp, &cstate->current_fh,
  371. create->cr_name, create->cr_namelen,
  372. &create->cr_iattr, S_IFDIR, 0, &resfh);
  373. break;
  374. default:
  375. status = nfserr_badtype;
  376. }
  377. if (!status) {
  378. fh_unlock(&cstate->current_fh);
  379. set_change_info(&create->cr_cinfo, &cstate->current_fh);
  380. fh_dup2(&cstate->current_fh, &resfh);
  381. }
  382. fh_put(&resfh);
  383. return status;
  384. }
  385. static __be32
  386. nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  387. struct nfsd4_getattr *getattr)
  388. {
  389. __be32 status;
  390. status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
  391. if (status)
  392. return status;
  393. if (getattr->ga_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)
  394. return nfserr_inval;
  395. getattr->ga_bmval[0] &= NFSD_SUPPORTED_ATTRS_WORD0;
  396. getattr->ga_bmval[1] &= NFSD_SUPPORTED_ATTRS_WORD1;
  397. getattr->ga_fhp = &cstate->current_fh;
  398. return nfs_ok;
  399. }
  400. static __be32
  401. nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  402. struct nfsd4_link *link)
  403. {
  404. __be32 status = nfserr_nofilehandle;
  405. if (!cstate->save_fh.fh_dentry)
  406. return status;
  407. status = nfsd_link(rqstp, &cstate->current_fh,
  408. link->li_name, link->li_namelen, &cstate->save_fh);
  409. if (!status)
  410. set_change_info(&link->li_cinfo, &cstate->current_fh);
  411. return status;
  412. }
  413. static __be32
  414. nfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  415. void *arg)
  416. {
  417. struct svc_fh tmp_fh;
  418. __be32 ret;
  419. fh_init(&tmp_fh, NFS4_FHSIZE);
  420. ret = exp_pseudoroot(rqstp, &tmp_fh);
  421. if (ret)
  422. return ret;
  423. if (tmp_fh.fh_dentry == cstate->current_fh.fh_dentry) {
  424. fh_put(&tmp_fh);
  425. return nfserr_noent;
  426. }
  427. fh_put(&tmp_fh);
  428. return nfsd_lookup(rqstp, &cstate->current_fh,
  429. "..", 2, &cstate->current_fh);
  430. }
  431. static __be32
  432. nfsd4_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  433. struct nfsd4_lookup *lookup)
  434. {
  435. return nfsd_lookup(rqstp, &cstate->current_fh,
  436. lookup->lo_name, lookup->lo_len,
  437. &cstate->current_fh);
  438. }
  439. static __be32
  440. nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  441. struct nfsd4_read *read)
  442. {
  443. __be32 status;
  444. /* no need to check permission - this will be done in nfsd_read() */
  445. read->rd_filp = NULL;
  446. if (read->rd_offset >= OFFSET_MAX)
  447. return nfserr_inval;
  448. nfs4_lock_state();
  449. /* check stateid */
  450. if ((status = nfs4_preprocess_stateid_op(&cstate->current_fh,
  451. &read->rd_stateid,
  452. CHECK_FH | RD_STATE, &read->rd_filp))) {
  453. dprintk("NFSD: nfsd4_read: couldn't process stateid!\n");
  454. goto out;
  455. }
  456. if (read->rd_filp)
  457. get_file(read->rd_filp);
  458. status = nfs_ok;
  459. out:
  460. nfs4_unlock_state();
  461. read->rd_rqstp = rqstp;
  462. read->rd_fhp = &cstate->current_fh;
  463. return status;
  464. }
  465. static __be32
  466. nfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  467. struct nfsd4_readdir *readdir)
  468. {
  469. u64 cookie = readdir->rd_cookie;
  470. static const nfs4_verifier zeroverf;
  471. /* no need to check permission - this will be done in nfsd_readdir() */
  472. if (readdir->rd_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)
  473. return nfserr_inval;
  474. readdir->rd_bmval[0] &= NFSD_SUPPORTED_ATTRS_WORD0;
  475. readdir->rd_bmval[1] &= NFSD_SUPPORTED_ATTRS_WORD1;
  476. if ((cookie > ~(u32)0) || (cookie == 1) || (cookie == 2) ||
  477. (cookie == 0 && memcmp(readdir->rd_verf.data, zeroverf.data, NFS4_VERIFIER_SIZE)))
  478. return nfserr_bad_cookie;
  479. readdir->rd_rqstp = rqstp;
  480. readdir->rd_fhp = &cstate->current_fh;
  481. return nfs_ok;
  482. }
  483. static __be32
  484. nfsd4_readlink(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  485. struct nfsd4_readlink *readlink)
  486. {
  487. readlink->rl_rqstp = rqstp;
  488. readlink->rl_fhp = &cstate->current_fh;
  489. return nfs_ok;
  490. }
  491. static __be32
  492. nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  493. struct nfsd4_remove *remove)
  494. {
  495. __be32 status;
  496. if (locks_in_grace())
  497. return nfserr_grace;
  498. status = nfsd_unlink(rqstp, &cstate->current_fh, 0,
  499. remove->rm_name, remove->rm_namelen);
  500. if (status == nfserr_symlink)
  501. return nfserr_notdir;
  502. if (!status) {
  503. fh_unlock(&cstate->current_fh);
  504. set_change_info(&remove->rm_cinfo, &cstate->current_fh);
  505. }
  506. return status;
  507. }
  508. static __be32
  509. nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  510. struct nfsd4_rename *rename)
  511. {
  512. __be32 status = nfserr_nofilehandle;
  513. if (!cstate->save_fh.fh_dentry)
  514. return status;
  515. if (locks_in_grace() && !(cstate->save_fh.fh_export->ex_flags
  516. & NFSEXP_NOSUBTREECHECK))
  517. return nfserr_grace;
  518. status = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname,
  519. rename->rn_snamelen, &cstate->current_fh,
  520. rename->rn_tname, rename->rn_tnamelen);
  521. /* the underlying filesystem returns different error's than required
  522. * by NFSv4. both save_fh and current_fh have been verified.. */
  523. if (status == nfserr_isdir)
  524. status = nfserr_exist;
  525. else if ((status == nfserr_notdir) &&
  526. (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mode) &&
  527. S_ISDIR(cstate->current_fh.fh_dentry->d_inode->i_mode)))
  528. status = nfserr_exist;
  529. else if (status == nfserr_symlink)
  530. status = nfserr_notdir;
  531. if (!status) {
  532. set_change_info(&rename->rn_sinfo, &cstate->current_fh);
  533. set_change_info(&rename->rn_tinfo, &cstate->save_fh);
  534. }
  535. return status;
  536. }
  537. static __be32
  538. nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  539. struct nfsd4_secinfo *secinfo)
  540. {
  541. struct svc_fh resfh;
  542. struct svc_export *exp;
  543. struct dentry *dentry;
  544. __be32 err;
  545. fh_init(&resfh, NFS4_FHSIZE);
  546. err = nfsd_lookup_dentry(rqstp, &cstate->current_fh,
  547. secinfo->si_name, secinfo->si_namelen,
  548. &exp, &dentry);
  549. if (err)
  550. return err;
  551. if (dentry->d_inode == NULL) {
  552. exp_put(exp);
  553. err = nfserr_noent;
  554. } else
  555. secinfo->si_exp = exp;
  556. dput(dentry);
  557. return err;
  558. }
  559. static __be32
  560. nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  561. struct nfsd4_setattr *setattr)
  562. {
  563. __be32 status = nfs_ok;
  564. if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
  565. nfs4_lock_state();
  566. status = nfs4_preprocess_stateid_op(&cstate->current_fh,
  567. &setattr->sa_stateid, CHECK_FH | WR_STATE, NULL);
  568. nfs4_unlock_state();
  569. if (status) {
  570. dprintk("NFSD: nfsd4_setattr: couldn't process stateid!\n");
  571. return status;
  572. }
  573. }
  574. status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt);
  575. if (status)
  576. return status;
  577. status = nfs_ok;
  578. if (setattr->sa_acl != NULL)
  579. status = nfsd4_set_nfs4_acl(rqstp, &cstate->current_fh,
  580. setattr->sa_acl);
  581. if (status)
  582. goto out;
  583. status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr,
  584. 0, (time_t)0);
  585. out:
  586. mnt_drop_write(cstate->current_fh.fh_export->ex_path.mnt);
  587. return status;
  588. }
  589. static __be32
  590. nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  591. struct nfsd4_write *write)
  592. {
  593. stateid_t *stateid = &write->wr_stateid;
  594. struct file *filp = NULL;
  595. u32 *p;
  596. __be32 status = nfs_ok;
  597. /* no need to check permission - this will be done in nfsd_write() */
  598. if (write->wr_offset >= OFFSET_MAX)
  599. return nfserr_inval;
  600. nfs4_lock_state();
  601. status = nfs4_preprocess_stateid_op(&cstate->current_fh, stateid,
  602. CHECK_FH | WR_STATE, &filp);
  603. if (filp)
  604. get_file(filp);
  605. nfs4_unlock_state();
  606. if (status) {
  607. dprintk("NFSD: nfsd4_write: couldn't process stateid!\n");
  608. return status;
  609. }
  610. write->wr_bytes_written = write->wr_buflen;
  611. write->wr_how_written = write->wr_stable_how;
  612. p = (u32 *)write->wr_verifier.data;
  613. *p++ = nfssvc_boot.tv_sec;
  614. *p++ = nfssvc_boot.tv_usec;
  615. status = nfsd_write(rqstp, &cstate->current_fh, filp,
  616. write->wr_offset, rqstp->rq_vec, write->wr_vlen,
  617. write->wr_buflen, &write->wr_how_written);
  618. if (filp)
  619. fput(filp);
  620. if (status == nfserr_symlink)
  621. status = nfserr_inval;
  622. return status;
  623. }
  624. /* This routine never returns NFS_OK! If there are no other errors, it
  625. * will return NFSERR_SAME or NFSERR_NOT_SAME depending on whether the
  626. * attributes matched. VERIFY is implemented by mapping NFSERR_SAME
  627. * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK.
  628. */
  629. static __be32
  630. _nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  631. struct nfsd4_verify *verify)
  632. {
  633. __be32 *buf, *p;
  634. int count;
  635. __be32 status;
  636. status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
  637. if (status)
  638. return status;
  639. if ((verify->ve_bmval[0] & ~NFSD_SUPPORTED_ATTRS_WORD0)
  640. || (verify->ve_bmval[1] & ~NFSD_SUPPORTED_ATTRS_WORD1))
  641. return nfserr_attrnotsupp;
  642. if ((verify->ve_bmval[0] & FATTR4_WORD0_RDATTR_ERROR)
  643. || (verify->ve_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1))
  644. return nfserr_inval;
  645. if (verify->ve_attrlen & 3)
  646. return nfserr_inval;
  647. /* count in words:
  648. * bitmap_len(1) + bitmap(2) + attr_len(1) = 4
  649. */
  650. count = 4 + (verify->ve_attrlen >> 2);
  651. buf = kmalloc(count << 2, GFP_KERNEL);
  652. if (!buf)
  653. return nfserr_resource;
  654. status = nfsd4_encode_fattr(&cstate->current_fh,
  655. cstate->current_fh.fh_export,
  656. cstate->current_fh.fh_dentry, buf,
  657. &count, verify->ve_bmval,
  658. rqstp, 0);
  659. /* this means that nfsd4_encode_fattr() ran out of space */
  660. if (status == nfserr_resource && count == 0)
  661. status = nfserr_not_same;
  662. if (status)
  663. goto out_kfree;
  664. p = buf + 3;
  665. status = nfserr_not_same;
  666. if (ntohl(*p++) != verify->ve_attrlen)
  667. goto out_kfree;
  668. if (!memcmp(p, verify->ve_attrval, verify->ve_attrlen))
  669. status = nfserr_same;
  670. out_kfree:
  671. kfree(buf);
  672. return status;
  673. }
  674. static __be32
  675. nfsd4_nverify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  676. struct nfsd4_verify *verify)
  677. {
  678. __be32 status;
  679. status = _nfsd4_verify(rqstp, cstate, verify);
  680. return status == nfserr_not_same ? nfs_ok : status;
  681. }
  682. static __be32
  683. nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  684. struct nfsd4_verify *verify)
  685. {
  686. __be32 status;
  687. status = _nfsd4_verify(rqstp, cstate, verify);
  688. return status == nfserr_same ? nfs_ok : status;
  689. }
  690. /*
  691. * NULL call.
  692. */
  693. static __be32
  694. nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
  695. {
  696. return nfs_ok;
  697. }
  698. static inline void nfsd4_increment_op_stats(u32 opnum)
  699. {
  700. if (opnum >= FIRST_NFS4_OP && opnum <= LAST_NFS4_OP)
  701. nfsdstats.nfs4_opcount[opnum]++;
  702. }
  703. static void cstate_free(struct nfsd4_compound_state *cstate)
  704. {
  705. if (cstate == NULL)
  706. return;
  707. fh_put(&cstate->current_fh);
  708. fh_put(&cstate->save_fh);
  709. BUG_ON(cstate->replay_owner);
  710. kfree(cstate);
  711. }
  712. static struct nfsd4_compound_state *cstate_alloc(void)
  713. {
  714. struct nfsd4_compound_state *cstate;
  715. cstate = kmalloc(sizeof(struct nfsd4_compound_state), GFP_KERNEL);
  716. if (cstate == NULL)
  717. return NULL;
  718. fh_init(&cstate->current_fh, NFS4_FHSIZE);
  719. fh_init(&cstate->save_fh, NFS4_FHSIZE);
  720. cstate->replay_owner = NULL;
  721. return cstate;
  722. }
  723. typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
  724. void *);
  725. struct nfsd4_operation {
  726. nfsd4op_func op_func;
  727. u32 op_flags;
  728. /* Most ops require a valid current filehandle; a few don't: */
  729. #define ALLOWED_WITHOUT_FH 1
  730. /* GETATTR and ops not listed as returning NFS4ERR_MOVED: */
  731. #define ALLOWED_ON_ABSENT_FS 2
  732. char *op_name;
  733. };
  734. static struct nfsd4_operation nfsd4_ops[];
  735. static const char *nfsd4_op_name(unsigned opnum);
  736. /*
  737. * COMPOUND call.
  738. */
  739. static __be32
  740. nfsd4_proc_compound(struct svc_rqst *rqstp,
  741. struct nfsd4_compoundargs *args,
  742. struct nfsd4_compoundres *resp)
  743. {
  744. struct nfsd4_op *op;
  745. struct nfsd4_operation *opdesc;
  746. struct nfsd4_compound_state *cstate = NULL;
  747. int slack_bytes;
  748. __be32 status;
  749. resp->xbuf = &rqstp->rq_res;
  750. resp->p = rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len;
  751. resp->tagp = resp->p;
  752. /* reserve space for: taglen, tag, and opcnt */
  753. resp->p += 2 + XDR_QUADLEN(args->taglen);
  754. resp->end = rqstp->rq_res.head[0].iov_base + PAGE_SIZE;
  755. resp->taglen = args->taglen;
  756. resp->tag = args->tag;
  757. resp->opcnt = 0;
  758. resp->rqstp = rqstp;
  759. /*
  760. * According to RFC3010, this takes precedence over all other errors.
  761. */
  762. status = nfserr_minor_vers_mismatch;
  763. if (args->minorversion > NFSD_SUPPORTED_MINOR_VERSION)
  764. goto out;
  765. status = nfserr_resource;
  766. cstate = cstate_alloc();
  767. if (cstate == NULL)
  768. goto out;
  769. status = nfs_ok;
  770. while (!status && resp->opcnt < args->opcnt) {
  771. op = &args->ops[resp->opcnt++];
  772. dprintk("nfsv4 compound op #%d/%d: %d (%s)\n",
  773. resp->opcnt, args->opcnt, op->opnum,
  774. nfsd4_op_name(op->opnum));
  775. /*
  776. * The XDR decode routines may have pre-set op->status;
  777. * for example, if there is a miscellaneous XDR error
  778. * it will be set to nfserr_bad_xdr.
  779. */
  780. if (op->status)
  781. goto encode_op;
  782. /* We must be able to encode a successful response to
  783. * this operation, with enough room left over to encode a
  784. * failed response to the next operation. If we don't
  785. * have enough room, fail with ERR_RESOURCE.
  786. */
  787. slack_bytes = (char *)resp->end - (char *)resp->p;
  788. if (slack_bytes < COMPOUND_SLACK_SPACE
  789. + COMPOUND_ERR_SLACK_SPACE) {
  790. BUG_ON(slack_bytes < COMPOUND_ERR_SLACK_SPACE);
  791. op->status = nfserr_resource;
  792. goto encode_op;
  793. }
  794. opdesc = &nfsd4_ops[op->opnum];
  795. if (!cstate->current_fh.fh_dentry) {
  796. if (!(opdesc->op_flags & ALLOWED_WITHOUT_FH)) {
  797. op->status = nfserr_nofilehandle;
  798. goto encode_op;
  799. }
  800. } else if (cstate->current_fh.fh_export->ex_fslocs.migrated &&
  801. !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) {
  802. op->status = nfserr_moved;
  803. goto encode_op;
  804. }
  805. if (opdesc->op_func)
  806. op->status = opdesc->op_func(rqstp, cstate, &op->u);
  807. else
  808. BUG_ON(op->status == nfs_ok);
  809. encode_op:
  810. if (op->status == nfserr_replay_me) {
  811. op->replay = &cstate->replay_owner->so_replay;
  812. nfsd4_encode_replay(resp, op);
  813. status = op->status = op->replay->rp_status;
  814. } else {
  815. nfsd4_encode_operation(resp, op);
  816. status = op->status;
  817. }
  818. if (cstate->replay_owner) {
  819. nfs4_put_stateowner(cstate->replay_owner);
  820. cstate->replay_owner = NULL;
  821. }
  822. /* XXX Ugh, we need to get rid of this kind of special case: */
  823. if (op->opnum == OP_READ && op->u.read.rd_filp)
  824. fput(op->u.read.rd_filp);
  825. nfsd4_increment_op_stats(op->opnum);
  826. }
  827. cstate_free(cstate);
  828. out:
  829. nfsd4_release_compoundargs(args);
  830. dprintk("nfsv4 compound returned %d\n", ntohl(status));
  831. return status;
  832. }
  833. static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
  834. [OP_ACCESS] = {
  835. .op_func = (nfsd4op_func)nfsd4_access,
  836. .op_name = "OP_ACCESS",
  837. },
  838. [OP_CLOSE] = {
  839. .op_func = (nfsd4op_func)nfsd4_close,
  840. .op_name = "OP_CLOSE",
  841. },
  842. [OP_COMMIT] = {
  843. .op_func = (nfsd4op_func)nfsd4_commit,
  844. .op_name = "OP_COMMIT",
  845. },
  846. [OP_CREATE] = {
  847. .op_func = (nfsd4op_func)nfsd4_create,
  848. .op_name = "OP_CREATE",
  849. },
  850. [OP_DELEGRETURN] = {
  851. .op_func = (nfsd4op_func)nfsd4_delegreturn,
  852. .op_name = "OP_DELEGRETURN",
  853. },
  854. [OP_GETATTR] = {
  855. .op_func = (nfsd4op_func)nfsd4_getattr,
  856. .op_flags = ALLOWED_ON_ABSENT_FS,
  857. .op_name = "OP_GETATTR",
  858. },
  859. [OP_GETFH] = {
  860. .op_func = (nfsd4op_func)nfsd4_getfh,
  861. .op_name = "OP_GETFH",
  862. },
  863. [OP_LINK] = {
  864. .op_func = (nfsd4op_func)nfsd4_link,
  865. .op_name = "OP_LINK",
  866. },
  867. [OP_LOCK] = {
  868. .op_func = (nfsd4op_func)nfsd4_lock,
  869. .op_name = "OP_LOCK",
  870. },
  871. [OP_LOCKT] = {
  872. .op_func = (nfsd4op_func)nfsd4_lockt,
  873. .op_name = "OP_LOCKT",
  874. },
  875. [OP_LOCKU] = {
  876. .op_func = (nfsd4op_func)nfsd4_locku,
  877. .op_name = "OP_LOCKU",
  878. },
  879. [OP_LOOKUP] = {
  880. .op_func = (nfsd4op_func)nfsd4_lookup,
  881. .op_name = "OP_LOOKUP",
  882. },
  883. [OP_LOOKUPP] = {
  884. .op_func = (nfsd4op_func)nfsd4_lookupp,
  885. .op_name = "OP_LOOKUPP",
  886. },
  887. [OP_NVERIFY] = {
  888. .op_func = (nfsd4op_func)nfsd4_nverify,
  889. .op_name = "OP_NVERIFY",
  890. },
  891. [OP_OPEN] = {
  892. .op_func = (nfsd4op_func)nfsd4_open,
  893. .op_name = "OP_OPEN",
  894. },
  895. [OP_OPEN_CONFIRM] = {
  896. .op_func = (nfsd4op_func)nfsd4_open_confirm,
  897. .op_name = "OP_OPEN_CONFIRM",
  898. },
  899. [OP_OPEN_DOWNGRADE] = {
  900. .op_func = (nfsd4op_func)nfsd4_open_downgrade,
  901. .op_name = "OP_OPEN_DOWNGRADE",
  902. },
  903. [OP_PUTFH] = {
  904. .op_func = (nfsd4op_func)nfsd4_putfh,
  905. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  906. .op_name = "OP_PUTFH",
  907. },
  908. [OP_PUTPUBFH] = {
  909. /* unsupported, just for future reference: */
  910. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  911. .op_name = "OP_PUTPUBFH",
  912. },
  913. [OP_PUTROOTFH] = {
  914. .op_func = (nfsd4op_func)nfsd4_putrootfh,
  915. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  916. .op_name = "OP_PUTROOTFH",
  917. },
  918. [OP_READ] = {
  919. .op_func = (nfsd4op_func)nfsd4_read,
  920. .op_name = "OP_READ",
  921. },
  922. [OP_READDIR] = {
  923. .op_func = (nfsd4op_func)nfsd4_readdir,
  924. .op_name = "OP_READDIR",
  925. },
  926. [OP_READLINK] = {
  927. .op_func = (nfsd4op_func)nfsd4_readlink,
  928. .op_name = "OP_READLINK",
  929. },
  930. [OP_REMOVE] = {
  931. .op_func = (nfsd4op_func)nfsd4_remove,
  932. .op_name = "OP_REMOVE",
  933. },
  934. [OP_RENAME] = {
  935. .op_name = "OP_RENAME",
  936. .op_func = (nfsd4op_func)nfsd4_rename,
  937. },
  938. [OP_RENEW] = {
  939. .op_func = (nfsd4op_func)nfsd4_renew,
  940. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  941. .op_name = "OP_RENEW",
  942. },
  943. [OP_RESTOREFH] = {
  944. .op_func = (nfsd4op_func)nfsd4_restorefh,
  945. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  946. .op_name = "OP_RESTOREFH",
  947. },
  948. [OP_SAVEFH] = {
  949. .op_func = (nfsd4op_func)nfsd4_savefh,
  950. .op_name = "OP_SAVEFH",
  951. },
  952. [OP_SECINFO] = {
  953. .op_func = (nfsd4op_func)nfsd4_secinfo,
  954. .op_name = "OP_SECINFO",
  955. },
  956. [OP_SETATTR] = {
  957. .op_func = (nfsd4op_func)nfsd4_setattr,
  958. .op_name = "OP_SETATTR",
  959. },
  960. [OP_SETCLIENTID] = {
  961. .op_func = (nfsd4op_func)nfsd4_setclientid,
  962. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  963. .op_name = "OP_SETCLIENTID",
  964. },
  965. [OP_SETCLIENTID_CONFIRM] = {
  966. .op_func = (nfsd4op_func)nfsd4_setclientid_confirm,
  967. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  968. .op_name = "OP_SETCLIENTID_CONFIRM",
  969. },
  970. [OP_VERIFY] = {
  971. .op_func = (nfsd4op_func)nfsd4_verify,
  972. .op_name = "OP_VERIFY",
  973. },
  974. [OP_WRITE] = {
  975. .op_func = (nfsd4op_func)nfsd4_write,
  976. .op_name = "OP_WRITE",
  977. },
  978. [OP_RELEASE_LOCKOWNER] = {
  979. .op_func = (nfsd4op_func)nfsd4_release_lockowner,
  980. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  981. .op_name = "OP_RELEASE_LOCKOWNER",
  982. },
  983. };
  984. static const char *nfsd4_op_name(unsigned opnum)
  985. {
  986. if (opnum < ARRAY_SIZE(nfsd4_ops))
  987. return nfsd4_ops[opnum].op_name;
  988. return "unknown_operation";
  989. }
  990. #define nfs4svc_decode_voidargs NULL
  991. #define nfs4svc_release_void NULL
  992. #define nfsd4_voidres nfsd4_voidargs
  993. #define nfs4svc_release_compound NULL
  994. struct nfsd4_voidargs { int dummy; };
  995. #define PROC(name, argt, rest, relt, cache, respsize) \
  996. { (svc_procfunc) nfsd4_proc_##name, \
  997. (kxdrproc_t) nfs4svc_decode_##argt##args, \
  998. (kxdrproc_t) nfs4svc_encode_##rest##res, \
  999. (kxdrproc_t) nfs4svc_release_##relt, \
  1000. sizeof(struct nfsd4_##argt##args), \
  1001. sizeof(struct nfsd4_##rest##res), \
  1002. 0, \
  1003. cache, \
  1004. respsize, \
  1005. }
  1006. /*
  1007. * TODO: At the present time, the NFSv4 server does not do XID caching
  1008. * of requests. Implementing XID caching would not be a serious problem,
  1009. * although it would require a mild change in interfaces since one
  1010. * doesn't know whether an NFSv4 request is idempotent until after the
  1011. * XDR decode. However, XID caching totally confuses pynfs (Peter
  1012. * Astrand's regression testsuite for NFSv4 servers), which reuses
  1013. * XID's liberally, so I've left it unimplemented until pynfs generates
  1014. * better XID's.
  1015. */
  1016. static struct svc_procedure nfsd_procedures4[2] = {
  1017. PROC(null, void, void, void, RC_NOCACHE, 1),
  1018. PROC(compound, compound, compound, compound, RC_NOCACHE, NFSD_BUFSIZE/4)
  1019. };
  1020. struct svc_version nfsd_version4 = {
  1021. .vs_vers = 4,
  1022. .vs_nproc = 2,
  1023. .vs_proc = nfsd_procedures4,
  1024. .vs_dispatch = nfsd_dispatch,
  1025. .vs_xdrsize = NFS4_SVC_XDRSIZE,
  1026. };
  1027. /*
  1028. * Local variables:
  1029. * c-basic-offset: 8
  1030. * End:
  1031. */