Skip to content

Commit 71c61a0

Browse files
chuckleverAnna Schumaker
authored andcommitted
NFSD: Short-circuit fh_verify tracepoints for LOCALIO
LOCALIO will be able to call fh_verify() with a NULL rqstp. In this case, the existing trace points need to be skipped because they want to dereference the address fields in the passed-in rqstp. Temporarily make these trace points conditional to avoid a seg fault in this case. Putting the "rqstp != NULL" check in the trace points themselves makes the check more efficient. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Acked-by: Jeff Layton <[email protected]> Reviewed-by: NeilBrown <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 7c0b07b commit 71c61a0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

fs/nfsd/trace.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,15 @@ TRACE_EVENT(nfsd_compound_encode_err,
193193
{ S_IFIFO, "FIFO" }, \
194194
{ S_IFSOCK, "SOCK" })
195195

196-
TRACE_EVENT(nfsd_fh_verify,
196+
TRACE_EVENT_CONDITION(nfsd_fh_verify,
197197
TP_PROTO(
198198
const struct svc_rqst *rqstp,
199199
const struct svc_fh *fhp,
200200
umode_t type,
201201
int access
202202
),
203203
TP_ARGS(rqstp, fhp, type, access),
204+
TP_CONDITION(rqstp != NULL),
204205
TP_STRUCT__entry(
205206
__field(unsigned int, netns_ino)
206207
__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
@@ -239,7 +240,7 @@ TRACE_EVENT_CONDITION(nfsd_fh_verify_err,
239240
__be32 error
240241
),
241242
TP_ARGS(rqstp, fhp, type, access, error),
242-
TP_CONDITION(error),
243+
TP_CONDITION(rqstp != NULL && error),
243244
TP_STRUCT__entry(
244245
__field(unsigned int, netns_ino)
245246
__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
@@ -295,12 +296,13 @@ DECLARE_EVENT_CLASS(nfsd_fh_err_class,
295296
__entry->status)
296297
)
297298

298-
#define DEFINE_NFSD_FH_ERR_EVENT(name) \
299-
DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name, \
300-
TP_PROTO(struct svc_rqst *rqstp, \
301-
struct svc_fh *fhp, \
302-
int status), \
303-
TP_ARGS(rqstp, fhp, status))
299+
#define DEFINE_NFSD_FH_ERR_EVENT(name) \
300+
DEFINE_EVENT_CONDITION(nfsd_fh_err_class, nfsd_##name, \
301+
TP_PROTO(struct svc_rqst *rqstp, \
302+
struct svc_fh *fhp, \
303+
int status), \
304+
TP_ARGS(rqstp, fhp, status), \
305+
TP_CONDITION(rqstp != NULL))
304306

305307
DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport);
306308
DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle);

0 commit comments

Comments
 (0)