Skip to content

Commit

Permalink
pnfs: Store return value of decode_layoutget for later processing
Browse files Browse the repository at this point in the history
This will be needed to seperate return value of OPEN and LAYOUTGET
when they are combined into a single RPC.

Signed-off-by: Fred Isaman <fred.isaman@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
  • Loading branch information
Fred Isaman authored and Trond Myklebust committed May 31, 2018
1 parent 34ec9aa commit 808ba32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions fs/nfs/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6024,7 +6024,7 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,

status = decode_op_hdr(xdr, OP_LAYOUTGET);
if (status)
return status;
goto out;
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
goto out_overflow;
Expand All @@ -6037,7 +6037,8 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
if (!layout_count) {
dprintk("%s: server responded with empty layout array\n",
__func__);
return -EINVAL;
status = -EINVAL;
goto out;
}

p = xdr_inline_decode(xdr, 28);
Expand All @@ -6062,7 +6063,8 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
dprintk("NFS: server cheating in layoutget reply: "
"layout len %u > recvd %u\n",
res->layoutp->len, recvd);
return -EINVAL;
status = -EINVAL;
goto out;
}

if (layout_count > 1) {
Expand All @@ -6075,10 +6077,13 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
__func__, layout_count);
}

return 0;
out:
res->status = status;
return status;
out_overflow:
print_overflow_msg(__func__, xdr);
return -EIO;
status = -EIO;
goto out;
}

static int decode_layoutreturn(struct xdr_stream *xdr,
Expand Down
1 change: 1 addition & 0 deletions include/linux/nfs_xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ struct nfs4_layoutget_args {

struct nfs4_layoutget_res {
struct nfs4_sequence_res seq_res;
int status;
__u32 return_on_close;
struct pnfs_layout_range range;
__u32 type;
Expand Down

0 comments on commit 808ba32

Please sign in to comment.