Skip to content

Commit 76f5af9

Browse files
Mike SnitzerAnna Schumaker
authored andcommitted
nfsd/localio: fix nfsd_file tracepoints to handle NULL rqstp
Otherwise nfsd_file_acquire, nfsd_file_insert_err, and nfsd_file_cons_err will hit a NULL pointer when they are enabled and LOCALIO used. Example trace output (note xid is 0x0 and LOCALIO flag set): nfsd_file_acquire: xid=0x0 inode=0000000069a1b2e7 may_flags=WRITE|LOCALIO ref=1 nf_flags=HASHED|GC nf_may=WRITE nf_file=0000000070123234 status=0 Fixes: c63f0e4 ("nfsd: add nfsd_file_acquire_local()") Signed-off-by: Mike Snitzer <[email protected]> Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 009b15b commit 76f5af9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/nfsd/trace.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ TRACE_EVENT(nfsd_file_acquire,
11131113
),
11141114

11151115
TP_fast_assign(
1116-
__entry->xid = be32_to_cpu(rqstp->rq_xid);
1116+
__entry->xid = rqstp ? be32_to_cpu(rqstp->rq_xid) : 0;
11171117
__entry->inode = inode;
11181118
__entry->may_flags = may_flags;
11191119
__entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0;
@@ -1147,7 +1147,7 @@ TRACE_EVENT(nfsd_file_insert_err,
11471147
__field(long, error)
11481148
),
11491149
TP_fast_assign(
1150-
__entry->xid = be32_to_cpu(rqstp->rq_xid);
1150+
__entry->xid = rqstp ? be32_to_cpu(rqstp->rq_xid) : 0;
11511151
__entry->inode = inode;
11521152
__entry->may_flags = may_flags;
11531153
__entry->error = error;
@@ -1177,7 +1177,7 @@ TRACE_EVENT(nfsd_file_cons_err,
11771177
__field(const void *, nf_file)
11781178
),
11791179
TP_fast_assign(
1180-
__entry->xid = be32_to_cpu(rqstp->rq_xid);
1180+
__entry->xid = rqstp ? be32_to_cpu(rqstp->rq_xid) : 0;
11811181
__entry->inode = inode;
11821182
__entry->may_flags = may_flags;
11831183
__entry->nf_ref = refcount_read(&nf->nf_ref);

0 commit comments

Comments
 (0)