nfs4proc.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176
  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. dprintk("nfsv4 compound op %p opcnt %d #%d: %d: status %d\n",
  819. args->ops, args->opcnt, resp->opcnt, op->opnum,
  820. be32_to_cpu(status));
  821. if (cstate->replay_owner) {
  822. nfs4_put_stateowner(cstate->replay_owner);
  823. cstate->replay_owner = NULL;
  824. }
  825. /* XXX Ugh, we need to get rid of this kind of special case: */
  826. if (op->opnum == OP_READ && op->u.read.rd_filp)
  827. fput(op->u.read.rd_filp);
  828. nfsd4_increment_op_stats(op->opnum);
  829. }
  830. cstate_free(cstate);
  831. out:
  832. nfsd4_release_compoundargs(args);
  833. dprintk("nfsv4 compound returned %d\n", ntohl(status));
  834. return status;
  835. }
  836. static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
  837. [OP_ACCESS] = {
  838. .op_func = (nfsd4op_func)nfsd4_access,
  839. .op_name = "OP_ACCESS",
  840. },
  841. [OP_CLOSE] = {
  842. .op_func = (nfsd4op_func)nfsd4_close,
  843. .op_name = "OP_CLOSE",
  844. },
  845. [OP_COMMIT] = {
  846. .op_func = (nfsd4op_func)nfsd4_commit,
  847. .op_name = "OP_COMMIT",
  848. },
  849. [OP_CREATE] = {
  850. .op_func = (nfsd4op_func)nfsd4_create,
  851. .op_name = "OP_CREATE",
  852. },
  853. [OP_DELEGRETURN] = {
  854. .op_func = (nfsd4op_func)nfsd4_delegreturn,
  855. .op_name = "OP_DELEGRETURN",
  856. },
  857. [OP_GETATTR] = {
  858. .op_func = (nfsd4op_func)nfsd4_getattr,
  859. .op_flags = ALLOWED_ON_ABSENT_FS,
  860. .op_name = "OP_GETATTR",
  861. },
  862. [OP_GETFH] = {
  863. .op_func = (nfsd4op_func)nfsd4_getfh,
  864. .op_name = "OP_GETFH",
  865. },
  866. [OP_LINK] = {
  867. .op_func = (nfsd4op_func)nfsd4_link,
  868. .op_name = "OP_LINK",
  869. },
  870. [OP_LOCK] = {
  871. .op_func = (nfsd4op_func)nfsd4_lock,
  872. .op_name = "OP_LOCK",
  873. },
  874. [OP_LOCKT] = {
  875. .op_func = (nfsd4op_func)nfsd4_lockt,
  876. .op_name = "OP_LOCKT",
  877. },
  878. [OP_LOCKU] = {
  879. .op_func = (nfsd4op_func)nfsd4_locku,
  880. .op_name = "OP_LOCKU",
  881. },
  882. [OP_LOOKUP] = {
  883. .op_func = (nfsd4op_func)nfsd4_lookup,
  884. .op_name = "OP_LOOKUP",
  885. },
  886. [OP_LOOKUPP] = {
  887. .op_func = (nfsd4op_func)nfsd4_lookupp,
  888. .op_name = "OP_LOOKUPP",
  889. },
  890. [OP_NVERIFY] = {
  891. .op_func = (nfsd4op_func)nfsd4_nverify,
  892. .op_name = "OP_NVERIFY",
  893. },
  894. [OP_OPEN] = {
  895. .op_func = (nfsd4op_func)nfsd4_open,
  896. .op_name = "OP_OPEN",
  897. },
  898. [OP_OPEN_CONFIRM] = {
  899. .op_func = (nfsd4op_func)nfsd4_open_confirm,
  900. .op_name = "OP_OPEN_CONFIRM",
  901. },
  902. [OP_OPEN_DOWNGRADE] = {
  903. .op_func = (nfsd4op_func)nfsd4_open_downgrade,
  904. .op_name = "OP_OPEN_DOWNGRADE",
  905. },
  906. [OP_PUTFH] = {
  907. .op_func = (nfsd4op_func)nfsd4_putfh,
  908. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  909. .op_name = "OP_PUTFH",
  910. },
  911. [OP_PUTPUBFH] = {
  912. /* unsupported, just for future reference: */
  913. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  914. .op_name = "OP_PUTPUBFH",
  915. },
  916. [OP_PUTROOTFH] = {
  917. .op_func = (nfsd4op_func)nfsd4_putrootfh,
  918. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  919. .op_name = "OP_PUTROOTFH",
  920. },
  921. [OP_READ] = {
  922. .op_func = (nfsd4op_func)nfsd4_read,
  923. .op_name = "OP_READ",
  924. },
  925. [OP_READDIR] = {
  926. .op_func = (nfsd4op_func)nfsd4_readdir,
  927. .op_name = "OP_READDIR",
  928. },
  929. [OP_READLINK] = {
  930. .op_func = (nfsd4op_func)nfsd4_readlink,
  931. .op_name = "OP_READLINK",
  932. },
  933. [OP_REMOVE] = {
  934. .op_func = (nfsd4op_func)nfsd4_remove,
  935. .op_name = "OP_REMOVE",
  936. },
  937. [OP_RENAME] = {
  938. .op_name = "OP_RENAME",
  939. .op_func = (nfsd4op_func)nfsd4_rename,
  940. },
  941. [OP_RENEW] = {
  942. .op_func = (nfsd4op_func)nfsd4_renew,
  943. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  944. .op_name = "OP_RENEW",
  945. },
  946. [OP_RESTOREFH] = {
  947. .op_func = (nfsd4op_func)nfsd4_restorefh,
  948. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  949. .op_name = "OP_RESTOREFH",
  950. },
  951. [OP_SAVEFH] = {
  952. .op_func = (nfsd4op_func)nfsd4_savefh,
  953. .op_name = "OP_SAVEFH",
  954. },
  955. [OP_SECINFO] = {
  956. .op_func = (nfsd4op_func)nfsd4_secinfo,
  957. .op_name = "OP_SECINFO",
  958. },
  959. [OP_SETATTR] = {
  960. .op_func = (nfsd4op_func)nfsd4_setattr,
  961. .op_name = "OP_SETATTR",
  962. },
  963. [OP_SETCLIENTID] = {
  964. .op_func = (nfsd4op_func)nfsd4_setclientid,
  965. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  966. .op_name = "OP_SETCLIENTID",
  967. },
  968. [OP_SETCLIENTID_CONFIRM] = {
  969. .op_func = (nfsd4op_func)nfsd4_setclientid_confirm,
  970. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  971. .op_name = "OP_SETCLIENTID_CONFIRM",
  972. },
  973. [OP_VERIFY] = {
  974. .op_func = (nfsd4op_func)nfsd4_verify,
  975. .op_name = "OP_VERIFY",
  976. },
  977. [OP_WRITE] = {
  978. .op_func = (nfsd4op_func)nfsd4_write,
  979. .op_name = "OP_WRITE",
  980. },
  981. [OP_RELEASE_LOCKOWNER] = {
  982. .op_func = (nfsd4op_func)nfsd4_release_lockowner,
  983. .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
  984. .op_name = "OP_RELEASE_LOCKOWNER",
  985. },
  986. };
  987. static const char *nfsd4_op_name(unsigned opnum)
  988. {
  989. if (opnum < ARRAY_SIZE(nfsd4_ops))
  990. return nfsd4_ops[opnum].op_name;
  991. return "unknown_operation";
  992. }
  993. #define nfs4svc_decode_voidargs NULL
  994. #define nfs4svc_release_void NULL
  995. #define nfsd4_voidres nfsd4_voidargs
  996. #define nfs4svc_release_compound NULL
  997. struct nfsd4_voidargs { int dummy; };
  998. #define PROC(name, argt, rest, relt, cache, respsize) \
  999. { (svc_procfunc) nfsd4_proc_##name, \
  1000. (kxdrproc_t) nfs4svc_decode_##argt##args, \
  1001. (kxdrproc_t) nfs4svc_encode_##rest##res, \
  1002. (kxdrproc_t) nfs4svc_release_##relt, \
  1003. sizeof(struct nfsd4_##argt##args), \
  1004. sizeof(struct nfsd4_##rest##res), \
  1005. 0, \
  1006. cache, \
  1007. respsize, \
  1008. }
  1009. /*
  1010. * TODO: At the present time, the NFSv4 server does not do XID caching
  1011. * of requests. Implementing XID caching would not be a serious problem,
  1012. * although it would require a mild change in interfaces since one
  1013. * doesn't know whether an NFSv4 request is idempotent until after the
  1014. * XDR decode. However, XID caching totally confuses pynfs (Peter
  1015. * Astrand's regression testsuite for NFSv4 servers), which reuses
  1016. * XID's liberally, so I've left it unimplemented until pynfs generates
  1017. * better XID's.
  1018. */
  1019. static struct svc_procedure nfsd_procedures4[2] = {
  1020. PROC(null, void, void, void, RC_NOCACHE, 1),
  1021. PROC(compound, compound, compound, compound, RC_NOCACHE, NFSD_BUFSIZE/4)
  1022. };
  1023. struct svc_version nfsd_version4 = {
  1024. .vs_vers = 4,
  1025. .vs_nproc = 2,
  1026. .vs_proc = nfsd_procedures4,
  1027. .vs_dispatch = nfsd_dispatch,
  1028. .vs_xdrsize = NFS4_SVC_XDRSIZE,
  1029. };
  1030. /*
  1031. * Local variables:
  1032. * c-basic-offset: 8
  1033. * End:
  1034. */