aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c69
1 files changed, 59 insertions, 10 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 8b21de8a06fa..7f91d613d31a 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -95,6 +95,8 @@ static int nfs_stat_to_errno(int);
95#define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz) 95#define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz)
96#define encode_savefh_maxsz (op_encode_hdr_maxsz) 96#define encode_savefh_maxsz (op_encode_hdr_maxsz)
97#define decode_savefh_maxsz (op_decode_hdr_maxsz) 97#define decode_savefh_maxsz (op_decode_hdr_maxsz)
98#define encode_restorefh_maxsz (op_encode_hdr_maxsz)
99#define decode_restorefh_maxsz (op_decode_hdr_maxsz)
98#define encode_fsinfo_maxsz (op_encode_hdr_maxsz + 2) 100#define encode_fsinfo_maxsz (op_encode_hdr_maxsz + 2)
99#define decode_fsinfo_maxsz (op_decode_hdr_maxsz + 11) 101#define decode_fsinfo_maxsz (op_decode_hdr_maxsz + 11)
100#define encode_renew_maxsz (op_encode_hdr_maxsz + 3) 102#define encode_renew_maxsz (op_encode_hdr_maxsz + 3)
@@ -336,14 +338,20 @@ static int nfs_stat_to_errno(int);
336 decode_getfh_maxsz) 338 decode_getfh_maxsz)
337#define NFS4_enc_create_sz (compound_encode_hdr_maxsz + \ 339#define NFS4_enc_create_sz (compound_encode_hdr_maxsz + \
338 encode_putfh_maxsz + \ 340 encode_putfh_maxsz + \
341 encode_savefh_maxsz + \
339 encode_create_maxsz + \ 342 encode_create_maxsz + \
343 encode_getfh_maxsz + \
340 encode_getattr_maxsz + \ 344 encode_getattr_maxsz + \
341 encode_getfh_maxsz) 345 encode_restorefh_maxsz + \
346 encode_getattr_maxsz)
342#define NFS4_dec_create_sz (compound_decode_hdr_maxsz + \ 347#define NFS4_dec_create_sz (compound_decode_hdr_maxsz + \
343 decode_putfh_maxsz + \ 348 decode_putfh_maxsz + \
349 decode_savefh_maxsz + \
344 decode_create_maxsz + \ 350 decode_create_maxsz + \
351 decode_getfh_maxsz + \
345 decode_getattr_maxsz + \ 352 decode_getattr_maxsz + \
346 decode_getfh_maxsz) 353 decode_restorefh_maxsz + \
354 decode_getattr_maxsz)
347#define NFS4_enc_pathconf_sz (compound_encode_hdr_maxsz + \ 355#define NFS4_enc_pathconf_sz (compound_encode_hdr_maxsz + \
348 encode_putfh_maxsz + \ 356 encode_putfh_maxsz + \
349 encode_getattr_maxsz) 357 encode_getattr_maxsz)
@@ -1113,6 +1121,17 @@ static int encode_renew(struct xdr_stream *xdr, const struct nfs4_client *client
1113} 1121}
1114 1122
1115static int 1123static int
1124encode_restorefh(struct xdr_stream *xdr)
1125{
1126 uint32_t *p;
1127
1128 RESERVE_SPACE(4);
1129 WRITE32(OP_RESTOREFH);
1130
1131 return 0;
1132}
1133
1134static int
1116encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) 1135encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg)
1117{ 1136{
1118 uint32_t *p; 1137 uint32_t *p;
@@ -1358,7 +1377,7 @@ static int nfs4_xdr_enc_create(struct rpc_rqst *req, uint32_t *p, const struct n
1358{ 1377{
1359 struct xdr_stream xdr; 1378 struct xdr_stream xdr;
1360 struct compound_hdr hdr = { 1379 struct compound_hdr hdr = {
1361 .nops = 4, 1380 .nops = 7,
1362 }; 1381 };
1363 int status; 1382 int status;
1364 1383
@@ -1366,10 +1385,16 @@ static int nfs4_xdr_enc_create(struct rpc_rqst *req, uint32_t *p, const struct n
1366 encode_compound_hdr(&xdr, &hdr); 1385 encode_compound_hdr(&xdr, &hdr);
1367 if ((status = encode_putfh(&xdr, args->dir_fh)) != 0) 1386 if ((status = encode_putfh(&xdr, args->dir_fh)) != 0)
1368 goto out; 1387 goto out;
1388 if ((status = encode_savefh(&xdr)) != 0)
1389 goto out;
1369 if ((status = encode_create(&xdr, args)) != 0) 1390 if ((status = encode_create(&xdr, args)) != 0)
1370 goto out; 1391 goto out;
1371 if ((status = encode_getfh(&xdr)) != 0) 1392 if ((status = encode_getfh(&xdr)) != 0)
1372 goto out; 1393 goto out;
1394 if ((status = encode_getfattr(&xdr, args->bitmask)) != 0)
1395 goto out;
1396 if ((status = encode_restorefh(&xdr)) != 0)
1397 goto out;
1373 status = encode_getfattr(&xdr, args->bitmask); 1398 status = encode_getfattr(&xdr, args->bitmask);
1374out: 1399out:
1375 return status; 1400 return status;
@@ -1429,7 +1454,7 @@ static int nfs4_xdr_enc_open(struct rpc_rqst *req, uint32_t *p, struct nfs_opena
1429{ 1454{
1430 struct xdr_stream xdr; 1455 struct xdr_stream xdr;
1431 struct compound_hdr hdr = { 1456 struct compound_hdr hdr = {
1432 .nops = 4, 1457 .nops = 7,
1433 }; 1458 };
1434 int status; 1459 int status;
1435 1460
@@ -1441,6 +1466,9 @@ static int nfs4_xdr_enc_open(struct rpc_rqst *req, uint32_t *p, struct nfs_opena
1441 status = encode_putfh(&xdr, args->fh); 1466 status = encode_putfh(&xdr, args->fh);
1442 if (status) 1467 if (status)
1443 goto out; 1468 goto out;
1469 status = encode_savefh(&xdr);
1470 if (status)
1471 goto out;
1444 status = encode_open(&xdr, args); 1472 status = encode_open(&xdr, args);
1445 if (status) 1473 if (status)
1446 goto out; 1474 goto out;
@@ -1448,6 +1476,12 @@ static int nfs4_xdr_enc_open(struct rpc_rqst *req, uint32_t *p, struct nfs_opena
1448 if (status) 1476 if (status)
1449 goto out; 1477 goto out;
1450 status = encode_getfattr(&xdr, args->bitmask); 1478 status = encode_getfattr(&xdr, args->bitmask);
1479 if (status)
1480 goto out;
1481 status = encode_restorefh(&xdr);
1482 if (status)
1483 goto out;
1484 status = encode_getfattr(&xdr, args->bitmask);
1451out: 1485out:
1452 return status; 1486 return status;
1453} 1487}
@@ -3218,6 +3252,12 @@ static int decode_renew(struct xdr_stream *xdr)
3218 return decode_op_hdr(xdr, OP_RENEW); 3252 return decode_op_hdr(xdr, OP_RENEW);
3219} 3253}
3220 3254
3255static int
3256decode_restorefh(struct xdr_stream *xdr)
3257{
3258 return decode_op_hdr(xdr, OP_RESTOREFH);
3259}
3260
3221static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, 3261static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
3222 size_t *acl_len) 3262 size_t *acl_len)
3223{ 3263{
@@ -3510,13 +3550,17 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_
3510 goto out; 3550 goto out;
3511 if ((status = decode_putfh(&xdr)) != 0) 3551 if ((status = decode_putfh(&xdr)) != 0)
3512 goto out; 3552 goto out;
3553 if ((status = decode_savefh(&xdr)) != 0)
3554 goto out;
3513 if ((status = decode_create(&xdr,&res->dir_cinfo)) != 0) 3555 if ((status = decode_create(&xdr,&res->dir_cinfo)) != 0)
3514 goto out; 3556 goto out;
3515 if ((status = decode_getfh(&xdr, res->fh)) != 0) 3557 if ((status = decode_getfh(&xdr, res->fh)) != 0)
3516 goto out; 3558 goto out;
3517 status = decode_getfattr(&xdr, res->fattr, res->server); 3559 if (decode_getfattr(&xdr, res->fattr, res->server) != 0)
3518 if (status == NFS4ERR_DELAY) 3560 goto out;
3519 status = 0; 3561 if ((status = decode_restorefh(&xdr)) != 0)
3562 goto out;
3563 decode_getfattr(&xdr, res->dir_fattr, res->server);
3520out: 3564out:
3521 return status; 3565 return status;
3522} 3566}
@@ -3654,15 +3698,20 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_ope
3654 status = decode_putfh(&xdr); 3698 status = decode_putfh(&xdr);
3655 if (status) 3699 if (status)
3656 goto out; 3700 goto out;
3701 status = decode_savefh(&xdr);
3702 if (status)
3703 goto out;
3657 status = decode_open(&xdr, res); 3704 status = decode_open(&xdr, res);
3658 if (status) 3705 if (status)
3659 goto out; 3706 goto out;
3660 status = decode_getfh(&xdr, &res->fh); 3707 status = decode_getfh(&xdr, &res->fh);
3661 if (status) 3708 if (status)
3662 goto out; 3709 goto out;
3663 status = decode_getfattr(&xdr, res->f_attr, res->server); 3710 if (decode_getfattr(&xdr, res->f_attr, res->server) != 0)
3664 if (status == NFS4ERR_DELAY) 3711 goto out;
3665 status = 0; 3712 if ((status = decode_restorefh(&xdr)) != 0)
3713 goto out;
3714 decode_getfattr(&xdr, res->dir_attr, res->server);
3666out: 3715out:
3667 return status; 3716 return status;
3668} 3717}