When debugging READ_PLUS issues sent to DS I noticed that layoutstats was reporting READ, though READ_PLUS was used. The ff_layout_io_track_ds_error function takes the 'major' opnum as an argumentas well as the corresponding resulting error code. By passing rpc task as an argument, the bogh values can be extracted insideff_layout_io_track_ds_error and reduce a possibility of calling with incorrect opnum. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@xxxxxxx> --- fs/nfs/flexfilelayout/flexfilelayout.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index a163533446fa..9da11586f685 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1213,11 +1213,13 @@ static int ff_layout_async_handle_error(struct rpc_task *task, static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, u32 idx, u64 offset, u64 length, - u32 *op_status, int opnum, int error) + u32 *op_status, struct rpc_task *task) { struct nfs4_ff_layout_mirror *mirror; u32 status = *op_status; int err; + int error = task->tk_status; + int opnum = task->tk_msg.rpc_proc->p_statidx; if (status == 0) { switch (error) { @@ -1279,8 +1281,7 @@ static int ff_layout_read_done_cb(struct rpc_task *task, if (task->tk_status < 0) { ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, hdr->args.offset, hdr->args.count, - &hdr->res.op_status, OP_READ, - task->tk_status); + &hdr->res.op_status, task); trace_ff_layout_read_error(hdr); } @@ -1446,8 +1447,7 @@ static int ff_layout_write_done_cb(struct rpc_task *task, if (task->tk_status < 0) { ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, hdr->args.offset, hdr->args.count, - &hdr->res.op_status, OP_WRITE, - task->tk_status); + &hdr->res.op_status, task); trace_ff_layout_write_error(hdr); } @@ -1492,8 +1492,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task, if (task->tk_status < 0) { ff_layout_io_track_ds_error(data->lseg, data->ds_commit_index, data->args.offset, data->args.count, - &data->res.op_status, OP_COMMIT, - task->tk_status); + &data->res.op_status, task); trace_ff_layout_commit_error(data); } -- 2.27.0