nfs42xdr.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp.com>
  4. */
  5. #ifndef __LINUX_FS_NFS_NFS4_2XDR_H
  6. #define __LINUX_FS_NFS_NFS4_2XDR_H
  7. #include "nfs42.h"
  8. #define encode_fallocate_maxsz (encode_stateid_maxsz + \
  9. 2 /* offset */ + \
  10. 2 /* length */)
  11. #define NFS42_WRITE_RES_SIZE (1 /* wr_callback_id size */ +\
  12. XDR_QUADLEN(NFS4_STATEID_SIZE) + \
  13. 2 /* wr_count */ + \
  14. 1 /* wr_committed */ + \
  15. XDR_QUADLEN(NFS4_VERIFIER_SIZE))
  16. #define encode_allocate_maxsz (op_encode_hdr_maxsz + \
  17. encode_fallocate_maxsz)
  18. #define decode_allocate_maxsz (op_decode_hdr_maxsz)
  19. #define encode_copy_maxsz (op_encode_hdr_maxsz + \
  20. XDR_QUADLEN(NFS4_STATEID_SIZE) + \
  21. XDR_QUADLEN(NFS4_STATEID_SIZE) + \
  22. 2 + 2 + 2 + 1 + 1 + 1)
  23. #define decode_copy_maxsz (op_decode_hdr_maxsz + \
  24. NFS42_WRITE_RES_SIZE + \
  25. 1 /* cr_consecutive */ + \
  26. 1 /* cr_synchronous */)
  27. #define encode_deallocate_maxsz (op_encode_hdr_maxsz + \
  28. encode_fallocate_maxsz)
  29. #define decode_deallocate_maxsz (op_decode_hdr_maxsz)
  30. #define encode_seek_maxsz (op_encode_hdr_maxsz + \
  31. encode_stateid_maxsz + \
  32. 2 /* offset */ + \
  33. 1 /* whence */)
  34. #define decode_seek_maxsz (op_decode_hdr_maxsz + \
  35. 1 /* eof */ + \
  36. 1 /* whence */ + \
  37. 2 /* offset */ + \
  38. 2 /* length */)
  39. #define encode_io_info_maxsz 4
  40. #define encode_layoutstats_maxsz (op_decode_hdr_maxsz + \
  41. 2 /* offset */ + \
  42. 2 /* length */ + \
  43. encode_stateid_maxsz + \
  44. encode_io_info_maxsz + \
  45. encode_io_info_maxsz + \
  46. 1 /* opaque devaddr4 length */ + \
  47. XDR_QUADLEN(PNFS_LAYOUTSTATS_MAXSIZE))
  48. #define decode_layoutstats_maxsz (op_decode_hdr_maxsz)
  49. #define encode_clone_maxsz (encode_stateid_maxsz + \
  50. encode_stateid_maxsz + \
  51. 2 /* src offset */ + \
  52. 2 /* dst offset */ + \
  53. 2 /* count */)
  54. #define decode_clone_maxsz (op_decode_hdr_maxsz)
  55. #define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \
  56. encode_putfh_maxsz + \
  57. encode_allocate_maxsz + \
  58. encode_getattr_maxsz)
  59. #define NFS4_dec_allocate_sz (compound_decode_hdr_maxsz + \
  60. decode_putfh_maxsz + \
  61. decode_allocate_maxsz + \
  62. decode_getattr_maxsz)
  63. #define NFS4_enc_copy_sz (compound_encode_hdr_maxsz + \
  64. encode_putfh_maxsz + \
  65. encode_savefh_maxsz + \
  66. encode_putfh_maxsz + \
  67. encode_copy_maxsz + \
  68. encode_commit_maxsz)
  69. #define NFS4_dec_copy_sz (compound_decode_hdr_maxsz + \
  70. decode_putfh_maxsz + \
  71. decode_savefh_maxsz + \
  72. decode_putfh_maxsz + \
  73. decode_copy_maxsz + \
  74. decode_commit_maxsz)
  75. #define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \
  76. encode_putfh_maxsz + \
  77. encode_deallocate_maxsz + \
  78. encode_getattr_maxsz)
  79. #define NFS4_dec_deallocate_sz (compound_decode_hdr_maxsz + \
  80. decode_putfh_maxsz + \
  81. decode_deallocate_maxsz + \
  82. decode_getattr_maxsz)
  83. #define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \
  84. encode_putfh_maxsz + \
  85. encode_seek_maxsz)
  86. #define NFS4_dec_seek_sz (compound_decode_hdr_maxsz + \
  87. decode_putfh_maxsz + \
  88. decode_seek_maxsz)
  89. #define NFS4_enc_layoutstats_sz (compound_encode_hdr_maxsz + \
  90. encode_sequence_maxsz + \
  91. encode_putfh_maxsz + \
  92. PNFS_LAYOUTSTATS_MAXDEV * encode_layoutstats_maxsz)
  93. #define NFS4_dec_layoutstats_sz (compound_decode_hdr_maxsz + \
  94. decode_sequence_maxsz + \
  95. decode_putfh_maxsz + \
  96. PNFS_LAYOUTSTATS_MAXDEV * decode_layoutstats_maxsz)
  97. #define NFS4_enc_clone_sz (compound_encode_hdr_maxsz + \
  98. encode_sequence_maxsz + \
  99. encode_putfh_maxsz + \
  100. encode_savefh_maxsz + \
  101. encode_putfh_maxsz + \
  102. encode_clone_maxsz + \
  103. encode_getattr_maxsz)
  104. #define NFS4_dec_clone_sz (compound_decode_hdr_maxsz + \
  105. decode_sequence_maxsz + \
  106. decode_putfh_maxsz + \
  107. decode_savefh_maxsz + \
  108. decode_putfh_maxsz + \
  109. decode_clone_maxsz + \
  110. decode_getattr_maxsz)
  111. static void encode_fallocate(struct xdr_stream *xdr,
  112. const struct nfs42_falloc_args *args)
  113. {
  114. encode_nfs4_stateid(xdr, &args->falloc_stateid);
  115. encode_uint64(xdr, args->falloc_offset);
  116. encode_uint64(xdr, args->falloc_length);
  117. }
  118. static void encode_allocate(struct xdr_stream *xdr,
  119. const struct nfs42_falloc_args *args,
  120. struct compound_hdr *hdr)
  121. {
  122. encode_op_hdr(xdr, OP_ALLOCATE, decode_allocate_maxsz, hdr);
  123. encode_fallocate(xdr, args);
  124. }
  125. static void encode_copy(struct xdr_stream *xdr,
  126. const struct nfs42_copy_args *args,
  127. struct compound_hdr *hdr)
  128. {
  129. encode_op_hdr(xdr, OP_COPY, decode_copy_maxsz, hdr);
  130. encode_nfs4_stateid(xdr, &args->src_stateid);
  131. encode_nfs4_stateid(xdr, &args->dst_stateid);
  132. encode_uint64(xdr, args->src_pos);
  133. encode_uint64(xdr, args->dst_pos);
  134. encode_uint64(xdr, args->count);
  135. encode_uint32(xdr, 1); /* consecutive = true */
  136. encode_uint32(xdr, 1); /* synchronous = true */
  137. encode_uint32(xdr, 0); /* src server list */
  138. }
  139. static void encode_deallocate(struct xdr_stream *xdr,
  140. const struct nfs42_falloc_args *args,
  141. struct compound_hdr *hdr)
  142. {
  143. encode_op_hdr(xdr, OP_DEALLOCATE, decode_deallocate_maxsz, hdr);
  144. encode_fallocate(xdr, args);
  145. }
  146. static void encode_seek(struct xdr_stream *xdr,
  147. const struct nfs42_seek_args *args,
  148. struct compound_hdr *hdr)
  149. {
  150. encode_op_hdr(xdr, OP_SEEK, decode_seek_maxsz, hdr);
  151. encode_nfs4_stateid(xdr, &args->sa_stateid);
  152. encode_uint64(xdr, args->sa_offset);
  153. encode_uint32(xdr, args->sa_what);
  154. }
  155. static void encode_layoutstats(struct xdr_stream *xdr,
  156. const struct nfs42_layoutstat_args *args,
  157. struct nfs42_layoutstat_devinfo *devinfo,
  158. struct compound_hdr *hdr)
  159. {
  160. __be32 *p;
  161. encode_op_hdr(xdr, OP_LAYOUTSTATS, decode_layoutstats_maxsz, hdr);
  162. p = reserve_space(xdr, 8 + 8);
  163. p = xdr_encode_hyper(p, devinfo->offset);
  164. p = xdr_encode_hyper(p, devinfo->length);
  165. encode_nfs4_stateid(xdr, &args->stateid);
  166. p = reserve_space(xdr, 4*8 + NFS4_DEVICEID4_SIZE + 4);
  167. p = xdr_encode_hyper(p, devinfo->read_count);
  168. p = xdr_encode_hyper(p, devinfo->read_bytes);
  169. p = xdr_encode_hyper(p, devinfo->write_count);
  170. p = xdr_encode_hyper(p, devinfo->write_bytes);
  171. p = xdr_encode_opaque_fixed(p, devinfo->dev_id.data,
  172. NFS4_DEVICEID4_SIZE);
  173. /* Encode layoutupdate4 */
  174. *p++ = cpu_to_be32(devinfo->layout_type);
  175. if (devinfo->ld_private.ops)
  176. devinfo->ld_private.ops->encode(xdr, args,
  177. &devinfo->ld_private);
  178. else
  179. encode_uint32(xdr, 0);
  180. }
  181. static void encode_clone(struct xdr_stream *xdr,
  182. const struct nfs42_clone_args *args,
  183. struct compound_hdr *hdr)
  184. {
  185. __be32 *p;
  186. encode_op_hdr(xdr, OP_CLONE, decode_clone_maxsz, hdr);
  187. encode_nfs4_stateid(xdr, &args->src_stateid);
  188. encode_nfs4_stateid(xdr, &args->dst_stateid);
  189. p = reserve_space(xdr, 3*8);
  190. p = xdr_encode_hyper(p, args->src_offset);
  191. p = xdr_encode_hyper(p, args->dst_offset);
  192. xdr_encode_hyper(p, args->count);
  193. }
  194. /*
  195. * Encode ALLOCATE request
  196. */
  197. static void nfs4_xdr_enc_allocate(struct rpc_rqst *req,
  198. struct xdr_stream *xdr,
  199. const void *data)
  200. {
  201. const struct nfs42_falloc_args *args = data;
  202. struct compound_hdr hdr = {
  203. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  204. };
  205. encode_compound_hdr(xdr, req, &hdr);
  206. encode_sequence(xdr, &args->seq_args, &hdr);
  207. encode_putfh(xdr, args->falloc_fh, &hdr);
  208. encode_allocate(xdr, args, &hdr);
  209. encode_getfattr(xdr, args->falloc_bitmask, &hdr);
  210. encode_nops(&hdr);
  211. }
  212. static void encode_copy_commit(struct xdr_stream *xdr,
  213. const struct nfs42_copy_args *args,
  214. struct compound_hdr *hdr)
  215. {
  216. __be32 *p;
  217. encode_op_hdr(xdr, OP_COMMIT, decode_commit_maxsz, hdr);
  218. p = reserve_space(xdr, 12);
  219. p = xdr_encode_hyper(p, args->dst_pos);
  220. *p = cpu_to_be32(args->count);
  221. }
  222. /*
  223. * Encode COPY request
  224. */
  225. static void nfs4_xdr_enc_copy(struct rpc_rqst *req,
  226. struct xdr_stream *xdr,
  227. const void *data)
  228. {
  229. const struct nfs42_copy_args *args = data;
  230. struct compound_hdr hdr = {
  231. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  232. };
  233. encode_compound_hdr(xdr, req, &hdr);
  234. encode_sequence(xdr, &args->seq_args, &hdr);
  235. encode_putfh(xdr, args->src_fh, &hdr);
  236. encode_savefh(xdr, &hdr);
  237. encode_putfh(xdr, args->dst_fh, &hdr);
  238. encode_copy(xdr, args, &hdr);
  239. encode_copy_commit(xdr, args, &hdr);
  240. encode_nops(&hdr);
  241. }
  242. /*
  243. * Encode DEALLOCATE request
  244. */
  245. static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req,
  246. struct xdr_stream *xdr,
  247. const void *data)
  248. {
  249. const struct nfs42_falloc_args *args = data;
  250. struct compound_hdr hdr = {
  251. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  252. };
  253. encode_compound_hdr(xdr, req, &hdr);
  254. encode_sequence(xdr, &args->seq_args, &hdr);
  255. encode_putfh(xdr, args->falloc_fh, &hdr);
  256. encode_deallocate(xdr, args, &hdr);
  257. encode_getfattr(xdr, args->falloc_bitmask, &hdr);
  258. encode_nops(&hdr);
  259. }
  260. /*
  261. * Encode SEEK request
  262. */
  263. static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
  264. struct xdr_stream *xdr,
  265. const void *data)
  266. {
  267. const struct nfs42_seek_args *args = data;
  268. struct compound_hdr hdr = {
  269. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  270. };
  271. encode_compound_hdr(xdr, req, &hdr);
  272. encode_sequence(xdr, &args->seq_args, &hdr);
  273. encode_putfh(xdr, args->sa_fh, &hdr);
  274. encode_seek(xdr, args, &hdr);
  275. encode_nops(&hdr);
  276. }
  277. /*
  278. * Encode LAYOUTSTATS request
  279. */
  280. static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req,
  281. struct xdr_stream *xdr,
  282. const void *data)
  283. {
  284. const struct nfs42_layoutstat_args *args = data;
  285. int i;
  286. struct compound_hdr hdr = {
  287. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  288. };
  289. encode_compound_hdr(xdr, req, &hdr);
  290. encode_sequence(xdr, &args->seq_args, &hdr);
  291. encode_putfh(xdr, args->fh, &hdr);
  292. WARN_ON(args->num_dev > PNFS_LAYOUTSTATS_MAXDEV);
  293. for (i = 0; i < args->num_dev; i++)
  294. encode_layoutstats(xdr, args, &args->devinfo[i], &hdr);
  295. encode_nops(&hdr);
  296. }
  297. /*
  298. * Encode CLONE request
  299. */
  300. static void nfs4_xdr_enc_clone(struct rpc_rqst *req,
  301. struct xdr_stream *xdr,
  302. const void *data)
  303. {
  304. const struct nfs42_clone_args *args = data;
  305. struct compound_hdr hdr = {
  306. .minorversion = nfs4_xdr_minorversion(&args->seq_args),
  307. };
  308. encode_compound_hdr(xdr, req, &hdr);
  309. encode_sequence(xdr, &args->seq_args, &hdr);
  310. encode_putfh(xdr, args->src_fh, &hdr);
  311. encode_savefh(xdr, &hdr);
  312. encode_putfh(xdr, args->dst_fh, &hdr);
  313. encode_clone(xdr, args, &hdr);
  314. encode_getfattr(xdr, args->dst_bitmask, &hdr);
  315. encode_nops(&hdr);
  316. }
  317. static int decode_allocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
  318. {
  319. return decode_op_hdr(xdr, OP_ALLOCATE);
  320. }
  321. static int decode_write_response(struct xdr_stream *xdr,
  322. struct nfs42_write_res *res)
  323. {
  324. __be32 *p;
  325. p = xdr_inline_decode(xdr, 4 + 8 + 4);
  326. if (unlikely(!p))
  327. goto out_overflow;
  328. /*
  329. * We never use asynchronous mode, so warn if a server returns
  330. * a stateid.
  331. */
  332. if (unlikely(*p != 0)) {
  333. pr_err_once("%s: server has set unrequested "
  334. "asynchronous mode\n", __func__);
  335. return -EREMOTEIO;
  336. }
  337. p++;
  338. p = xdr_decode_hyper(p, &res->count);
  339. res->verifier.committed = be32_to_cpup(p);
  340. return decode_verifier(xdr, &res->verifier.verifier);
  341. out_overflow:
  342. print_overflow_msg(__func__, xdr);
  343. return -EIO;
  344. }
  345. static int decode_copy_requirements(struct xdr_stream *xdr,
  346. struct nfs42_copy_res *res) {
  347. __be32 *p;
  348. p = xdr_inline_decode(xdr, 4 + 4);
  349. if (unlikely(!p))
  350. goto out_overflow;
  351. res->consecutive = be32_to_cpup(p++);
  352. res->synchronous = be32_to_cpup(p++);
  353. return 0;
  354. out_overflow:
  355. print_overflow_msg(__func__, xdr);
  356. return -EIO;
  357. }
  358. static int decode_copy(struct xdr_stream *xdr, struct nfs42_copy_res *res)
  359. {
  360. int status;
  361. status = decode_op_hdr(xdr, OP_COPY);
  362. if (status == NFS4ERR_OFFLOAD_NO_REQS) {
  363. status = decode_copy_requirements(xdr, res);
  364. if (status)
  365. return status;
  366. return NFS4ERR_OFFLOAD_NO_REQS;
  367. } else if (status)
  368. return status;
  369. status = decode_write_response(xdr, &res->write_res);
  370. if (status)
  371. return status;
  372. return decode_copy_requirements(xdr, res);
  373. }
  374. static int decode_deallocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
  375. {
  376. return decode_op_hdr(xdr, OP_DEALLOCATE);
  377. }
  378. static int decode_seek(struct xdr_stream *xdr, struct nfs42_seek_res *res)
  379. {
  380. int status;
  381. __be32 *p;
  382. status = decode_op_hdr(xdr, OP_SEEK);
  383. if (status)
  384. return status;
  385. p = xdr_inline_decode(xdr, 4 + 8);
  386. if (unlikely(!p))
  387. goto out_overflow;
  388. res->sr_eof = be32_to_cpup(p++);
  389. p = xdr_decode_hyper(p, &res->sr_offset);
  390. return 0;
  391. out_overflow:
  392. print_overflow_msg(__func__, xdr);
  393. return -EIO;
  394. }
  395. static int decode_layoutstats(struct xdr_stream *xdr)
  396. {
  397. return decode_op_hdr(xdr, OP_LAYOUTSTATS);
  398. }
  399. static int decode_clone(struct xdr_stream *xdr)
  400. {
  401. return decode_op_hdr(xdr, OP_CLONE);
  402. }
  403. /*
  404. * Decode ALLOCATE request
  405. */
  406. static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
  407. struct xdr_stream *xdr,
  408. void *data)
  409. {
  410. struct nfs42_falloc_res *res = data;
  411. struct compound_hdr hdr;
  412. int status;
  413. status = decode_compound_hdr(xdr, &hdr);
  414. if (status)
  415. goto out;
  416. status = decode_sequence(xdr, &res->seq_res, rqstp);
  417. if (status)
  418. goto out;
  419. status = decode_putfh(xdr);
  420. if (status)
  421. goto out;
  422. status = decode_allocate(xdr, res);
  423. if (status)
  424. goto out;
  425. decode_getfattr(xdr, res->falloc_fattr, res->falloc_server);
  426. out:
  427. return status;
  428. }
  429. /*
  430. * Decode COPY response
  431. */
  432. static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
  433. struct xdr_stream *xdr,
  434. void *data)
  435. {
  436. struct nfs42_copy_res *res = data;
  437. struct compound_hdr hdr;
  438. int status;
  439. status = decode_compound_hdr(xdr, &hdr);
  440. if (status)
  441. goto out;
  442. status = decode_sequence(xdr, &res->seq_res, rqstp);
  443. if (status)
  444. goto out;
  445. status = decode_putfh(xdr);
  446. if (status)
  447. goto out;
  448. status = decode_savefh(xdr);
  449. if (status)
  450. goto out;
  451. status = decode_putfh(xdr);
  452. if (status)
  453. goto out;
  454. status = decode_copy(xdr, res);
  455. if (status)
  456. goto out;
  457. status = decode_commit(xdr, &res->commit_res);
  458. out:
  459. return status;
  460. }
  461. /*
  462. * Decode DEALLOCATE request
  463. */
  464. static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
  465. struct xdr_stream *xdr,
  466. void *data)
  467. {
  468. struct nfs42_falloc_res *res = data;
  469. struct compound_hdr hdr;
  470. int status;
  471. status = decode_compound_hdr(xdr, &hdr);
  472. if (status)
  473. goto out;
  474. status = decode_sequence(xdr, &res->seq_res, rqstp);
  475. if (status)
  476. goto out;
  477. status = decode_putfh(xdr);
  478. if (status)
  479. goto out;
  480. status = decode_deallocate(xdr, res);
  481. if (status)
  482. goto out;
  483. decode_getfattr(xdr, res->falloc_fattr, res->falloc_server);
  484. out:
  485. return status;
  486. }
  487. /*
  488. * Decode SEEK request
  489. */
  490. static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
  491. struct xdr_stream *xdr,
  492. void *data)
  493. {
  494. struct nfs42_seek_res *res = data;
  495. struct compound_hdr hdr;
  496. int status;
  497. status = decode_compound_hdr(xdr, &hdr);
  498. if (status)
  499. goto out;
  500. status = decode_sequence(xdr, &res->seq_res, rqstp);
  501. if (status)
  502. goto out;
  503. status = decode_putfh(xdr);
  504. if (status)
  505. goto out;
  506. status = decode_seek(xdr, res);
  507. out:
  508. return status;
  509. }
  510. /*
  511. * Decode LAYOUTSTATS request
  512. */
  513. static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
  514. struct xdr_stream *xdr,
  515. void *data)
  516. {
  517. struct nfs42_layoutstat_res *res = data;
  518. struct compound_hdr hdr;
  519. int status, i;
  520. status = decode_compound_hdr(xdr, &hdr);
  521. if (status)
  522. goto out;
  523. status = decode_sequence(xdr, &res->seq_res, rqstp);
  524. if (status)
  525. goto out;
  526. status = decode_putfh(xdr);
  527. if (status)
  528. goto out;
  529. WARN_ON(res->num_dev > PNFS_LAYOUTSTATS_MAXDEV);
  530. for (i = 0; i < res->num_dev; i++) {
  531. status = decode_layoutstats(xdr);
  532. if (status)
  533. goto out;
  534. }
  535. out:
  536. res->rpc_status = status;
  537. return status;
  538. }
  539. /*
  540. * Decode CLONE request
  541. */
  542. static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp,
  543. struct xdr_stream *xdr,
  544. void *data)
  545. {
  546. struct nfs42_clone_res *res = data;
  547. struct compound_hdr hdr;
  548. int status;
  549. status = decode_compound_hdr(xdr, &hdr);
  550. if (status)
  551. goto out;
  552. status = decode_sequence(xdr, &res->seq_res, rqstp);
  553. if (status)
  554. goto out;
  555. status = decode_putfh(xdr);
  556. if (status)
  557. goto out;
  558. status = decode_savefh(xdr);
  559. if (status)
  560. goto out;
  561. status = decode_putfh(xdr);
  562. if (status)
  563. goto out;
  564. status = decode_clone(xdr);
  565. if (status)
  566. goto out;
  567. status = decode_getfattr(xdr, res->dst_fattr, res->server);
  568. out:
  569. res->rpc_status = status;
  570. return status;
  571. }
  572. #endif /* __LINUX_FS_NFS_NFS4_2XDR_H */