Skip to content

Commit bead8b4

Browse files
author
Trond Myklebust
committed
pNFS/flexfiles: Record the RPC errors in the I/O tracepoints
When debugging I/O issues, we want to see not just the NFS level errors, but also the RPC level problems, so record both in the tracepoints. Signed-off-by: Trond Myklebust <[email protected]>
1 parent 440caf8 commit bead8b4

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

fs/nfs/flexfilelayout/flexfilelayout.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ static int ff_layout_read_done_cb(struct rpc_task *task,
13291329
hdr->args.offset, hdr->args.count,
13301330
&hdr->res.op_status, OP_READ,
13311331
task->tk_status);
1332-
trace_ff_layout_read_error(hdr);
1332+
trace_ff_layout_read_error(hdr, task->tk_status);
13331333
}
13341334

13351335
err = ff_layout_async_handle_error(task, hdr->args.context->state,
@@ -1502,7 +1502,7 @@ static int ff_layout_write_done_cb(struct rpc_task *task,
15021502
hdr->args.offset, hdr->args.count,
15031503
&hdr->res.op_status, OP_WRITE,
15041504
task->tk_status);
1505-
trace_ff_layout_write_error(hdr);
1505+
trace_ff_layout_write_error(hdr, task->tk_status);
15061506
}
15071507

15081508
err = ff_layout_async_handle_error(task, hdr->args.context->state,
@@ -1551,7 +1551,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task,
15511551
data->args.offset, data->args.count,
15521552
&data->res.op_status, OP_COMMIT,
15531553
task->tk_status);
1554-
trace_ff_layout_commit_error(data);
1554+
trace_ff_layout_commit_error(data, task->tk_status);
15551555
}
15561556

15571557
err = ff_layout_async_handle_error(task, NULL, data->ds_clp,

fs/nfs/nfs4trace.h

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,13 +2051,15 @@ TRACE_EVENT(fl_getdevinfo,
20512051

20522052
DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
20532053
TP_PROTO(
2054-
const struct nfs_pgio_header *hdr
2054+
const struct nfs_pgio_header *hdr,
2055+
int error
20552056
),
20562057

2057-
TP_ARGS(hdr),
2058+
TP_ARGS(hdr, error),
20582059

20592060
TP_STRUCT__entry(
20602061
__field(unsigned long, error)
2062+
__field(unsigned long, nfs_error)
20612063
__field(dev_t, dev)
20622064
__field(u32, fhandle)
20632065
__field(u64, fileid)
@@ -2073,7 +2075,8 @@ DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
20732075
TP_fast_assign(
20742076
const struct inode *inode = hdr->inode;
20752077

2076-
__entry->error = hdr->res.op_status;
2078+
__entry->error = -error;
2079+
__entry->nfs_error = hdr->res.op_status;
20772080
__entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
20782081
__entry->fileid = NFS_FILEID(inode);
20792082
__entry->dev = inode->i_sb->s_dev;
@@ -2088,36 +2091,41 @@ DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
20882091

20892092
TP_printk(
20902093
"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2091-
"offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2094+
"offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s "
2095+
"nfs_error=%lu (%s)",
20922096
-__entry->error,
20932097
show_nfs4_status(__entry->error),
20942098
MAJOR(__entry->dev), MINOR(__entry->dev),
20952099
(unsigned long long)__entry->fileid,
20962100
__entry->fhandle,
20972101
__entry->offset, __entry->count,
20982102
__entry->stateid_seq, __entry->stateid_hash,
2099-
__get_str(dstaddr)
2103+
__get_str(dstaddr), __entry->nfs_error,
2104+
show_nfs4_status(__entry->nfs_error)
21002105
)
21012106
);
21022107

21032108
#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
21042109
DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
21052110
TP_PROTO( \
2106-
const struct nfs_pgio_header *hdr \
2111+
const struct nfs_pgio_header *hdr, \
2112+
int error \
21072113
), \
2108-
TP_ARGS(hdr))
2114+
TP_ARGS(hdr, error))
21092115
DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
21102116
DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
21112117

21122118
TRACE_EVENT(ff_layout_commit_error,
21132119
TP_PROTO(
2114-
const struct nfs_commit_data *data
2120+
const struct nfs_commit_data *data,
2121+
int error
21152122
),
21162123

2117-
TP_ARGS(data),
2124+
TP_ARGS(data, error),
21182125

21192126
TP_STRUCT__entry(
21202127
__field(unsigned long, error)
2128+
__field(unsigned long, nfs_error)
21212129
__field(dev_t, dev)
21222130
__field(u32, fhandle)
21232131
__field(u64, fileid)
@@ -2131,7 +2139,8 @@ TRACE_EVENT(ff_layout_commit_error,
21312139
TP_fast_assign(
21322140
const struct inode *inode = data->inode;
21332141

2134-
__entry->error = data->res.op_status;
2142+
__entry->error = -error;
2143+
__entry->nfs_error = data->res.op_status;
21352144
__entry->fhandle = nfs_fhandle_hash(data->args.fh);
21362145
__entry->fileid = NFS_FILEID(inode);
21372146
__entry->dev = inode->i_sb->s_dev;
@@ -2142,14 +2151,15 @@ TRACE_EVENT(ff_layout_commit_error,
21422151

21432152
TP_printk(
21442153
"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2145-
"offset=%llu count=%u dstaddr=%s",
2154+
"offset=%llu count=%u dstaddr=%s nfs_error=%lu (%s)",
21462155
-__entry->error,
21472156
show_nfs4_status(__entry->error),
21482157
MAJOR(__entry->dev), MINOR(__entry->dev),
21492158
(unsigned long long)__entry->fileid,
21502159
__entry->fhandle,
21512160
__entry->offset, __entry->count,
2152-
__get_str(dstaddr)
2161+
__get_str(dstaddr), __entry->nfs_error,
2162+
show_nfs4_status(__entry->nfs_error)
21532163
)
21542164
);
21552165

0 commit comments

Comments
 (0)