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. /*
  94. * Following rfc 3530 14.2.16, use the returned bitmask
  95. * to indicate which attributes we used to store the
  96. * verifier:
  97. */
  98. if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
  99. open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS |
  100. FATTR4_WORD1_TIME_MODIFY);
  101. } else {
  102. status = nfsd_lookup(rqstp, current_fh,
  103. open->op_fname.data, open->op_fname.len, &resfh);
  104. fh_unlock(current_fh);
  105. }
  106. if (status)
  107. goto out;
  108. set_change_info(&open->op_cinfo, current_fh);
  109. fh_dup2(current_fh, &resfh);
  110. /* set reply cache */
  111. fh_copy_shallow(&open->op_stateowner->so_replay.rp_openfh,
  112. &resfh.fh_handle);
  113. if (!created)
  114. status = do_open_permission(rqstp, current_fh, open,
  115. NFSD_MAY_NOP);
  116. out:
  117. fh_put(&resfh);
  118. return status;
  119. }
  120. static __be32
  121. do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
  122. {
  123. __be32 status;
  124. /* Only reclaims from previously confirmed clients are valid */
  125. if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
  126. return status;
  127. /* We don't know the target directory, and therefore can not
  128. * set the change info
  129. */
  130. memset(&open->op_cinfo, 0, sizeof(struct nfsd4_change_info));
  131. /* set replay cache */
  132. fh_copy_shallow(&open->op_stateowner->so_replay.rp_openfh,
  133. &current_fh->fh_handle);
  134. open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
  135. (open->op_iattr.ia_size == 0);
  136. status = do_open_permission(rqstp, current_fh, open,
  137. NFSD_MAY_OWNER_OVERRIDE);
  138. return status;
  139. }
  140. static __be32
  141. nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  142. struct nfsd4_open *open)
  143. {
  144. __be32 status;
  145. dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
  146. (int)open->op_fname.len, open->op_fname.data,
  147. open->op_stateowner);
  148. /* This check required by spec. */
  149. if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
  150. return nfserr_inval;
  151. nfs4_lock_state();
  152. /* check seqid for replay. set nfs4_owner */
  153. status = nfsd4_process_open1(open);
  154. if (status == nfserr_replay_me) {
  155. struct nfs4_replay *rp = &open->op_stateowner->so_replay;
  156. fh_put(&cstate->current_fh);
  157. fh_copy_shallow(&cstate->current_fh.fh_handle,
  158. &rp->rp_openfh);
  159. status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
  160. if (status)
  161. dprintk("nfsd4_open: replay failed"
  162. " restoring previous filehandle\n");
  163. else
  164. status = nfserr_replay_me;
  165. }
  166. if (status)
  167. goto out;
  168. /* Openowner is now set, so sequence id will get bumped. Now we need
  169. * these checks before we do any creates: */
  170. status = nfserr_grace;
  171. if (locks_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
  172. goto out;
  173. status = nfserr_no_grace;
  174. if (!locks_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
  175. goto out;
  176. switch (open->op_claim_type) {
  177. case NFS4_OPEN_CLAIM_DELEGATE_CUR:
  178. status = nfserr_inval;
  179. if (open->op_create)
  180. goto out;
  181. /* fall through */
  182. case NFS4_OPEN_CLAIM_NULL:
  183. /*
  184. * (1) set CURRENT_FH to the file being opened,
  185. * creating it if necessary, (2) set open->op_cinfo,
  186. * (3) set open->op_truncate if the file is to be
  187. * truncated after opening, (4) do permission checking.
  188. */
  189. status = do_open_lookup(rqstp, &cstate->current_fh,
  190. open);
  191. if (status)
  192. goto out;
  193. break;
  194. case NFS4_OPEN_CLAIM_PREVIOUS:
  195. open->op_stateowner->so_confirmed = 1;
  196. /*
  197. * The CURRENT_FH is already set to the file being
  198. * opened. (1) set open->op_cinfo, (2) set
  199. * open->op_truncate if the file is to be truncated
  200. * after opening, (3) do permission checking.
  201. */
  202. status = do_open_fhandle(rqstp, &cstate->current_fh,
  203. open);
  204. if (status)
  205. goto out;
  206. break;
  207. case NFS4_OPEN_CLAIM_DELEGATE_PREV:
  208. open->op_stateowner->so_confirmed = 1;
  209. dprintk("NFSD: unsupported OPEN claim type %d\n",
  210. open->op_claim_type);
  211. status = nfserr_notsupp;
  212. goto out;
  213. default:
  214. dprintk("NFSD: Invalid OPEN claim type %d\n",
  215. open->op_claim_type);
  216. status = nfserr_inval;
  217. goto out;
  218. }
  219. /*
  220. * nfsd4_process_open2() does the actual opening of the file. If
  221. * successful, it (1) truncates the file if open->op_truncate was
  222. * set, (2) sets open->op_stateid, (3) sets open->op_delegation.
  223. */
  224. status = nfsd4_process_open2(rqstp, &cstate->current_fh, open);
  225. out:
  226. if (open->op_stateowner) {
  227. nfs4_get_stateowner(open->op_stateowner);
  228. cstate->replay_owner = open->op_stateowner;
  229. }
  230. nfs4_unlock_state();
  231. return status;
  232. }
  233. /*
  234. * filehandle-manipulating ops.
  235. */
  236. static __be32
  237. nfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  238. struct svc_fh **getfh)
  239. {
  240. if (!cstate->current_fh.fh_dentry)
  241. return nfserr_nofilehandle;
  242. *getfh = &cstate->current_fh;
  243. return nfs_ok;
  244. }
  245. static __be32
  246. nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  247. struct nfsd4_putfh *putfh)
  248. {
  249. fh_put(&cstate->current_fh);
  250. cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;
  251. memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,
  252. putfh->pf_fhlen);
  253. return fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
  254. }
  255. static __be32
  256. nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  257. void *arg)
  258. {
  259. __be32 status;
  260. fh_put(&cstate->current_fh);
  261. status = exp_pseudoroot(rqstp, &cstate->current_fh);
  262. return status;
  263. }
  264. static __be32
  265. nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  266. void *arg)
  267. {
  268. if (!cstate->save_fh.fh_dentry)
  269. return nfserr_restorefh;
  270. fh_dup2(&cstate->current_fh, &cstate->save_fh);
  271. return nfs_ok;
  272. }
  273. static __be32
  274. nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  275. void *arg)
  276. {
  277. if (!cstate->current_fh.fh_dentry)
  278. return nfserr_nofilehandle;
  279. fh_dup2(&cstate->save_fh, &cstate->current_fh);
  280. return nfs_ok;
  281. }
  282. /*
  283. * misc nfsv4 ops
  284. */
  285. static __be32
  286. nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  287. struct nfsd4_access *access)
  288. {
  289. if (access->ac_req_access & ~NFS3_ACCESS_FULL)
  290. return nfserr_inval;
  291. access->ac_resp_access = access->ac_req_access;
  292. return nfsd_access(rqstp, &cstate->current_fh, &access->ac_resp_access,
  293. &access->ac_supported);
  294. }
  295. static __be32
  296. nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  297. struct nfsd4_commit *commit)
  298. {
  299. __be32 status;
  300. u32 *p = (u32 *)commit->co_verf.data;
  301. *p++ = nfssvc_boot.tv_sec;
  302. *p++ = nfssvc_boot.tv_usec;
  303. status = nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset,
  304. commit->co_count);
  305. if (status == nfserr_symlink)
  306. status = nfserr_inval;
  307. return status;
  308. }
  309. static __be32
  310. nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  311. struct nfsd4_create *create)
  312. {
  313. struct svc_fh resfh;
  314. __be32 status;
  315. dev_t rdev;
  316. fh_init(&resfh, NFS4_FHSIZE);
  317. status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR,
  318. NFSD_MAY_CREATE);
  319. if (status == nfserr_symlink)
  320. status = nfserr_notdir;
  321. if (status)
  322. return status;
  323. switch (create->cr_type) {
  324. case NF4LNK:
  325. /* ugh! we have to null-terminate the linktext, or
  326. * vfs_symlink() will choke. it is always safe to
  327. * null-terminate by brute force, since at worst we
  328. * will overwrite the first byte of the create namelen
  329. * in the XDR buffer, which has already been extracted
  330. * during XDR decode.
  331. */
  332. create->cr_linkname[create->cr_linklen] = 0;
  333. status = nfsd_symlink(rqstp, &cstate->current_fh,
  334. create->cr_name, create->cr_namelen,
  335. create->cr_linkname, create->cr_linklen,
  336. &resfh, &create->cr_iattr);
  337. break;
  338. case NF4BLK:
  339. rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
  340. if (MAJOR(rdev) != create->cr_specdata1 ||
  341. MINOR(rdev) != create->cr_specdata2)
  342. return nfserr_inval;
  343. status = nfsd_create(rqstp, &cstate->current_fh,
  344. create->cr_name, create->cr_namelen,
  345. &create->cr_iattr, S_IFBLK, rdev, &resfh);
  346. break;
  347. case NF4CHR:
  348. rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
  349. if (MAJOR(rdev) != create->cr_specdata1 ||
  350. MINOR(rdev) != create->cr_specdata2)
  351. return nfserr_inval;
  352. status = nfsd_create(rqstp, &cstate->current_fh,
  353. create->cr_name, create->cr_namelen,
  354. &create->cr_iattr,S_IFCHR, rdev, &resfh);
  355. break;
  356. case NF4SOCK:
  357. status = nfsd_create(rqstp, &cstate->current_fh,
  358. create->cr_name, create->cr_namelen,
  359. &create->cr_iattr, S_IFSOCK, 0, &resfh);
  360. break;
  361. case NF4FIFO:
  362. status = nfsd_create(rqstp, &cstate->current_fh,
  363. create->cr_name, create->cr_namelen,
  364. &create->cr_iattr, S_IFIFO, 0, &resfh);
  365. break;
  366. case NF4DIR:
  367. create->cr_iattr.ia_valid &= ~ATTR_SIZE;
  368. status = nfsd_create(rqstp, &cstate->current_fh,
  369. create->cr_name, create->cr_namelen,
  370. &create->cr_iattr, S_IFDIR, 0, &resfh);
  371. break;
  372. default:
  373. status = nfserr_badtype;
  374. }
  375. if (!status) {
  376. fh_unlock(&cstate->current_fh);
  377. set_change_info(&create->cr_cinfo, &cstate->current_fh);
  378. fh_dup2(&cstate->current_fh, &resfh);
  379. }
  380. fh_put(&resfh);
  381. return status;
  382. }
  383. static __be32
  384. nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  385. struct nfsd4_getattr *getattr)
  386. {
  387. __be32 status;
  388. status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
  389. if (status)
  390. return status;
  391. if (getattr->ga_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)
  392. return nfserr_inval;
  393. getattr->ga_bmval[0] &= NFSD_SUPPORTED_ATTRS_WORD0;
  394. getattr->ga_bmval[1] &= NFSD_SUPPORTED_ATTRS_WORD1;
  395. getattr->ga_fhp = &cstate->current_fh;
  396. return nfs_ok;
  397. }
  398. static __be32
  399. nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  400. struct nfsd4_link *link)
  401. {
  402. __be32 status = nfserr_nofilehandle;
  403. if (!cstate->save_fh.fh_dentry)
  404. return status;
  405. status = nfsd_link(rqstp, &cstate->current_fh,
  406. link->li_name, link->li_namelen, &cstate->save_fh);
  407. if (!status)
  408. set_change_info(&link->li_cinfo, &cstate->current_fh);
  409. return status;
  410. }
  411. static __be32
  412. nfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  413. void *arg)
  414. {
  415. struct svc_fh tmp_fh;
  416. __be32 ret;
  417. fh_init(&tmp_fh, NFS4_FHSIZE);
  418. ret = exp_pseudoroot(rqstp, &tmp_fh);
  419. if (ret)
  420. return ret;
  421. if (tmp_fh.fh_dentry == cstate->current_fh.fh_dentry) {
  422. fh_put(&tmp_fh);
  423. return nfserr_noent;
  424. }
  425. fh_put(&tmp_fh);
  426. return nfsd_lookup(rqstp, &cstate->current_fh,
  427. "..", 2, &cstate->current_fh);
  428. }
  429. static __be32
  430. nfsd4_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  431. struct nfsd4_lookup *lookup)
  432. {
  433. return nfsd_lookup(rqstp, &cstate->current_fh,
  434. lookup->lo_name, lookup->lo_len,
  435. &cstate->current_fh);
  436. }
  437. static __be32
  438. nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  439. struct nfsd4_read *read)
  440. {
  441. __be32 status;
  442. /* no need to check permission - this will be done in nfsd_read() */
  443. read->rd_filp = NULL;
  444. if (read->rd_offset >= OFFSET_MAX)
  445. return nfserr_inval;
  446. nfs4_lock_state();
  447. /* check stateid */
  448. if ((status = nfs4_preprocess_stateid_op(&cstate->current_fh,
  449. &read->rd_stateid,
  450. RD_STATE, &read->rd_filp))) {
  451. dprintk("NFSD: nfsd4_read: couldn't process stateid!\n");
  452. goto out;
  453. }
  454. if (read->rd_filp)
  455. get_file(read->rd_filp);
  456. status = nfs_ok;
  457. out:
  458. nfs4_unlock_state();
  459. read->rd_rqstp = rqstp;
  460. read->rd_fhp = &cstate->current_fh;
  461. return status;
  462. }
  463. static __be32
  464. nfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  465. struct nfsd4_readdir *readdir)
  466. {
  467. u64 cookie = readdir->rd_cookie;
  468. static const nfs4_verifier zeroverf;
  469. /* no need to check permission - this will be done in nfsd_readdir() */
  470. if (readdir->rd_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1)
  471. return nfserr_inval;
  472. readdir->rd_bmval[0] &= NFSD_SUPPORTED_ATTRS_WORD0;
  473. readdir->rd_bmval[1] &= NFSD_SUPPORTED_ATTRS_WORD1;
  474. if ((cookie > ~(u32)0) || (cookie == 1) || (cookie == 2) ||
  475. (cookie == 0 && memcmp(readdir->rd_verf.data, zeroverf.data, NFS4_VERIFIER_SIZE)))
  476. return nfserr_bad_cookie;
  477. readdir->rd_rqstp = rqstp;
  478. readdir->rd_fhp = &cstate->current_fh;
  479. return nfs_ok;
  480. }
  481. static __be32
  482. nfsd4_readlink(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  483. struct nfsd4_readlink *readlink)
  484. {
  485. readlink->rl_rqstp = rqstp;
  486. readlink->rl_fhp = &cstate->current_fh;
  487. return nfs_ok;
  488. }
  489. static __be32
  490. nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  491. struct nfsd4_remove *remove)
  492. {
  493. __be32 status;
  494. if (locks_in_grace())
  495. return nfserr_grace;
  496. status = nfsd_unlink(rqstp, &cstate->current_fh, 0,
  497. remove->rm_name, remove->rm_namelen);
  498. if (status == nfserr_symlink)
  499. return nfserr_notdir;
  500. if (!status) {
  501. fh_unlock(&cstate->current_fh);
  502. set_change_info(&remove->rm_cinfo, &cstate->current_fh);
  503. }
  504. return status;
  505. }
  506. static __be32
  507. nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  508. struct nfsd4_rename *rename)
  509. {
  510. __be32 status = nfserr_nofilehandle;
  511. if (!cstate->save_fh.fh_dentry)
  512. return status;
  513. if (locks_in_grace() && !(cstate->save_fh.fh_export->ex_flags
  514. & NFSEXP_NOSUBTREECHECK))
  515. return nfserr_grace;
  516. status = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname,
  517. rename->rn_snamelen, &cstate->current_fh,
  518. rename->rn_tname, rename->rn_tnamelen);
  519. /* the underlying filesystem returns different error's than required
  520. * by NFSv4. both save_fh and current_fh have been verified.. */
  521. if (status == nfserr_isdir)
  522. status = nfserr_exist;
  523. else if ((status == nfserr_notdir) &&
  524. (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mode) &&
  525. S_ISDIR(cstate->current_fh.fh_dentry->d_inode->i_mode)))
  526. status = nfserr_exist;
  527. else if (status == nfserr_symlink)
  528. status = nfserr_notdir;
  529. if (!status) {
  530. set_change_info(&rename->rn_sinfo, &cstate->current_fh);
  531. set_change_info(&rename->rn_tinfo, &cstate->save_fh);
  532. }
  533. return status;
  534. }
  535. static __be32
  536. nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  537. struct nfsd4_secinfo *secinfo)
  538. {
  539. struct svc_fh resfh;
  540. struct svc_export *exp;
  541. struct dentry *dentry;
  542. __be32 err;
  543. fh_init(&resfh, NFS4_FHSIZE);
  544. err = nfsd_lookup_dentry(rqstp, &cstate->current_fh,
  545. secinfo->si_name, secinfo->si_namelen,
  546. &exp, &dentry);
  547. if (err)
  548. return err;
  549. if (dentry->d_inode == NULL) {
  550. exp_put(exp);
  551. err = nfserr_noent;
  552. } else
  553. secinfo->si_exp = exp;
  554. dput(dentry);
  555. return err;
  556. }
  557. static __be32
  558. nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  559. struct nfsd4_setattr *setattr)
  560. {
  561. __be32 status = nfs_ok;
  562. if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
  563. nfs4_lock_state();
  564. status = nfs4_preprocess_stateid_op(&cstate->current_fh,
  565. &setattr->sa_stateid, WR_STATE, NULL);
  566. nfs4_unlock_state();
  567. if (status) {
  568. dprintk("NFSD: nfsd4_setattr: couldn't process stateid!\n");
  569. return status;
  570. }
  571. }
  572. status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt);
  573. if (status)
  574. return status;
  575. status = nfs_ok;
  576. if (setattr->sa_acl != NULL)
  577. status = nfsd4_set_nfs4_acl(rqstp, &cstate->current_fh,
  578. setattr->sa_acl);
  579. if (status)
  580. goto out;
  581. status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr,
  582. 0, (time_t)0);
  583. out:
  584. mnt_drop_write(cstate->current_fh.fh_export->ex_path.mnt);
  585. return status;
  586. }
  587. static __be32
  588. nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
  589. struct nfsd4_write *write)
  590. {
  591. stateid_t *stateid = &write->wr_stateid;
  592. struct file *filp = NULL;
  593. u32 *p;
  594. __be32 status = nfs_ok;
  595. unsigned long cnt;
  596. /* no need to check permission - this will be done in nfsd_write() */
  597. if (write->wr_offset >= OFFSET_MAX)
  598. return nfserr_inval;
  599. nfs4_lock_state();
  600. status = nfs4_preprocess_stateid_op(&cstate->current_fh, stateid,
  601. WR_STATE, &filp);
  602. if (filp)
  603. get_file(filp);
  604. nfs4_unlock_state();
  605. if (status) {
  606. dprintk("NFSD: nfsd4_write: couldn't process stateid!\n");
  607. return status;
  608. }
  609. cnt = write->wr_buflen;
  610. write->wr_how_written = write->wr_stable_how;
  611. p = (u32 *)write->wr_verifier.data;
  612. *p++ = nfssvc_boot.tv_sec;
  613. *p++ = nfssvc_boot.tv_usec;
  614. status = nfsd_write(rqstp, &cstate->current_fh, filp,
  615. write->wr_offset, rqstp->rq_vec, write->wr_vlen,
  616. &cnt, &write->wr_how_written);
  617. if (filp)
  618. fput(filp);
  619. write->wr_bytes_written = cnt;
  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. */