aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-08-27 20:37:39 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-08-27 20:42:20 -0400
commitd13549074cf066d6d5bb29903d044beffea342d3 (patch)
tree0d4167522dbc760366ff0fb9b66425c894d4d3ff
parent5334c5bdac926c5f8d89729beccb46fe88eda9e7 (diff)
NFSv4.1/flexfiles: Fix a protocol error in layoutreturn
According to the flexfiles protocol, the layoutreturn should specify an array of errors in the following format: struct ff_ioerr4 { offset4 ffie_offset; length4 ffie_length; stateid4 ffie_stateid; device_error4 ffie_errors<>; }; This patch fixes up the code to ensure that our ffie_errors is indeed encoded as an array (albeit with only a single entry). Reported-by: Tom Haynes <thomas.haynes@primarydata.com> Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayoutdev.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index f13e1969eedd..b28fa4cbea52 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -500,16 +500,19 @@ int ff_layout_encode_ds_ioerr(struct nfs4_flexfile_layout *flo,
500 range->offset, range->length)) 500 range->offset, range->length))
501 continue; 501 continue;
502 /* offset(8) + length(8) + stateid(NFS4_STATEID_SIZE) 502 /* offset(8) + length(8) + stateid(NFS4_STATEID_SIZE)
503 * + deviceid(NFS4_DEVICEID4_SIZE) + status(4) + opnum(4) 503 * + array length + deviceid(NFS4_DEVICEID4_SIZE)
504 * + status(4) + opnum(4)
504 */ 505 */
505 p = xdr_reserve_space(xdr, 506 p = xdr_reserve_space(xdr,
506 24 + NFS4_STATEID_SIZE + NFS4_DEVICEID4_SIZE); 507 28 + NFS4_STATEID_SIZE + NFS4_DEVICEID4_SIZE);
507 if (unlikely(!p)) 508 if (unlikely(!p))
508 return -ENOBUFS; 509 return -ENOBUFS;
509 p = xdr_encode_hyper(p, err->offset); 510 p = xdr_encode_hyper(p, err->offset);
510 p = xdr_encode_hyper(p, err->length); 511 p = xdr_encode_hyper(p, err->length);
511 p = xdr_encode_opaque_fixed(p, &err->stateid, 512 p = xdr_encode_opaque_fixed(p, &err->stateid,
512 NFS4_STATEID_SIZE); 513 NFS4_STATEID_SIZE);
514 /* Encode 1 error */
515 *p++ = cpu_to_be32(1);
513 p = xdr_encode_opaque_fixed(p, &err->deviceid, 516 p = xdr_encode_opaque_fixed(p, &err->deviceid,
514 NFS4_DEVICEID4_SIZE); 517 NFS4_DEVICEID4_SIZE);
515 *p++ = cpu_to_be32(err->status); 518 *p++ = cpu_to_be32(err->status);