Commit aabff4dd authored by Peng Tao's avatar Peng Tao Committed by Tom Haynes

nfs: save server READ/WRITE/COMMIT status

Flexfiles layout would want to use them to report DS IO status.
Signed-off-by: default avatarPeng Tao <tao.peng@primarydata.com>
Signed-off-by: default avatarTom Haynes <Thomas.Haynes@primarydata.com>
parent 9bf87482
...@@ -481,7 +481,8 @@ static int decode_path(struct xdr_stream *xdr) ...@@ -481,7 +481,8 @@ static int decode_path(struct xdr_stream *xdr)
* void; * void;
* }; * };
*/ */
static int decode_attrstat(struct xdr_stream *xdr, struct nfs_fattr *result) static int decode_attrstat(struct xdr_stream *xdr, struct nfs_fattr *result,
__u32 *op_status)
{ {
enum nfs_stat status; enum nfs_stat status;
int error; int error;
...@@ -489,6 +490,8 @@ static int decode_attrstat(struct xdr_stream *xdr, struct nfs_fattr *result) ...@@ -489,6 +490,8 @@ static int decode_attrstat(struct xdr_stream *xdr, struct nfs_fattr *result)
error = decode_stat(xdr, &status); error = decode_stat(xdr, &status);
if (unlikely(error)) if (unlikely(error))
goto out; goto out;
if (op_status)
*op_status = status;
if (status != NFS_OK) if (status != NFS_OK)
goto out_default; goto out_default;
error = decode_fattr(xdr, result); error = decode_fattr(xdr, result);
...@@ -808,7 +811,7 @@ static int nfs2_xdr_dec_stat(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -808,7 +811,7 @@ static int nfs2_xdr_dec_stat(struct rpc_rqst *req, struct xdr_stream *xdr,
static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_fattr *result) struct nfs_fattr *result)
{ {
return decode_attrstat(xdr, result); return decode_attrstat(xdr, result, NULL);
} }
static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr,
...@@ -865,6 +868,7 @@ static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -865,6 +868,7 @@ static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
error = decode_stat(xdr, &status); error = decode_stat(xdr, &status);
if (unlikely(error)) if (unlikely(error))
goto out; goto out;
result->op_status = status;
if (status != NFS_OK) if (status != NFS_OK)
goto out_default; goto out_default;
error = decode_fattr(xdr, result->fattr); error = decode_fattr(xdr, result->fattr);
...@@ -882,7 +886,7 @@ static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -882,7 +886,7 @@ static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr,
{ {
/* All NFSv2 writes are "file sync" writes */ /* All NFSv2 writes are "file sync" writes */
result->verf->committed = NFS_FILE_SYNC; result->verf->committed = NFS_FILE_SYNC;
return decode_attrstat(xdr, result->fattr); return decode_attrstat(xdr, result->fattr, &result->op_status);
} }
/** /**
......
...@@ -1636,6 +1636,7 @@ static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -1636,6 +1636,7 @@ static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr,
error = decode_post_op_attr(xdr, result->fattr); error = decode_post_op_attr(xdr, result->fattr);
if (unlikely(error)) if (unlikely(error))
goto out; goto out;
result->op_status = status;
if (status != NFS3_OK) if (status != NFS3_OK)
goto out_status; goto out_status;
error = decode_read3resok(xdr, result); error = decode_read3resok(xdr, result);
...@@ -1708,6 +1709,7 @@ static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -1708,6 +1709,7 @@ static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr,
error = decode_wcc_data(xdr, result->fattr); error = decode_wcc_data(xdr, result->fattr);
if (unlikely(error)) if (unlikely(error))
goto out; goto out;
result->op_status = status;
if (status != NFS3_OK) if (status != NFS3_OK)
goto out_status; goto out_status;
error = decode_write3resok(xdr, result); error = decode_write3resok(xdr, result);
...@@ -2323,6 +2325,7 @@ static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, ...@@ -2323,6 +2325,7 @@ static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req,
error = decode_wcc_data(xdr, result->fattr); error = decode_wcc_data(xdr, result->fattr);
if (unlikely(error)) if (unlikely(error))
goto out; goto out;
result->op_status = status;
if (status != NFS3_OK) if (status != NFS3_OK)
goto out_status; goto out_status;
error = decode_writeverf3(xdr, &result->verf->verifier); error = decode_writeverf3(xdr, &result->verf->verifier);
......
...@@ -6567,6 +6567,7 @@ static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -6567,6 +6567,7 @@ static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
int status; int status;
status = decode_compound_hdr(xdr, &hdr); status = decode_compound_hdr(xdr, &hdr);
res->op_status = hdr.status;
if (status) if (status)
goto out; goto out;
status = decode_sequence(xdr, &res->seq_res, rqstp); status = decode_sequence(xdr, &res->seq_res, rqstp);
...@@ -6592,6 +6593,7 @@ static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -6592,6 +6593,7 @@ static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
int status; int status;
status = decode_compound_hdr(xdr, &hdr); status = decode_compound_hdr(xdr, &hdr);
res->op_status = hdr.status;
if (status) if (status)
goto out; goto out;
status = decode_sequence(xdr, &res->seq_res, rqstp); status = decode_sequence(xdr, &res->seq_res, rqstp);
...@@ -6621,6 +6623,7 @@ static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -6621,6 +6623,7 @@ static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
int status; int status;
status = decode_compound_hdr(xdr, &hdr); status = decode_compound_hdr(xdr, &hdr);
res->op_status = hdr.status;
if (status) if (status)
goto out; goto out;
status = decode_sequence(xdr, &res->seq_res, rqstp); status = decode_sequence(xdr, &res->seq_res, rqstp);
......
...@@ -513,6 +513,7 @@ struct nfs_pgio_res { ...@@ -513,6 +513,7 @@ struct nfs_pgio_res {
struct nfs4_sequence_res seq_res; struct nfs4_sequence_res seq_res;
struct nfs_fattr * fattr; struct nfs_fattr * fattr;
__u32 count; __u32 count;
__u32 op_status;
int eof; /* used by read */ int eof; /* used by read */
struct nfs_writeverf * verf; /* used by write */ struct nfs_writeverf * verf; /* used by write */
const struct nfs_server *server; /* used by write */ const struct nfs_server *server; /* used by write */
...@@ -532,6 +533,7 @@ struct nfs_commitargs { ...@@ -532,6 +533,7 @@ struct nfs_commitargs {
struct nfs_commitres { struct nfs_commitres {
struct nfs4_sequence_res seq_res; struct nfs4_sequence_res seq_res;
__u32 op_status;
struct nfs_fattr *fattr; struct nfs_fattr *fattr;
struct nfs_writeverf *verf; struct nfs_writeverf *verf;
const struct nfs_server *server; const struct nfs_server *server;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment