summaryrefslogtreecommitdiff
path: root/include/trace
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2021-06-18 13:19:49 +0300
committerDavid Howells <dhowells@redhat.com>2021-08-27 15:34:02 +0300
commit33cba859220b0878b3b2931caa1629a3d2432379 (patch)
tree16479e10dd084bd8193cf70946bfe8367a127c9a /include/trace
parent35b72573e977ed6b18b094136a4fa3e0ffb13603 (diff)
downloadlinux-33cba859220b0878b3b2931caa1629a3d2432379.tar.xz
fscache: Fix fscache_cookie_put() to not deref after dec
fscache_cookie_put() accesses the cookie it has just put inside the tracepoint that monitors the change - but this is something it's not allowed to do if we didn't reduce the count to zero. Fix this by dropping most of those values from the tracepoint and grabbing the cookie debug ID before doing the dec. Also take the opportunity to switch over the usage and where arguments on the tracepoint to put the reason last. Fixes: a18feb55769b ("fscache: Add tracepoints") Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/162431203107.2908479.3259582550347000088.stgit@warthog.procyon.org.uk/
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/fscache.h24
1 files changed, 7 insertions, 17 deletions
diff --git a/include/trace/events/fscache.h b/include/trace/events/fscache.h
index 33d1fd5d0383..19d65d9d4357 100644
--- a/include/trace/events/fscache.h
+++ b/include/trace/events/fscache.h
@@ -160,37 +160,27 @@ fscache_cookie_traces;
TRACE_EVENT(fscache_cookie,
- TP_PROTO(struct fscache_cookie *cookie,
- enum fscache_cookie_trace where,
- int usage),
+ TP_PROTO(unsigned int cookie_debug_id,
+ int usage,
+ enum fscache_cookie_trace where),
- TP_ARGS(cookie, where, usage),
+ TP_ARGS(cookie_debug_id, usage, where),
TP_STRUCT__entry(
__field(unsigned int, cookie )
- __field(unsigned int, parent )
__field(enum fscache_cookie_trace, where )
__field(int, usage )
- __field(int, n_children )
- __field(int, n_active )
- __field(u8, flags )
),
TP_fast_assign(
- __entry->cookie = cookie->debug_id;
- __entry->parent = cookie->parent ? cookie->parent->debug_id : 0;
+ __entry->cookie = cookie_debug_id;
__entry->where = where;
__entry->usage = usage;
- __entry->n_children = atomic_read(&cookie->n_children);
- __entry->n_active = atomic_read(&cookie->n_active);
- __entry->flags = cookie->flags;
),
- TP_printk("%s c=%08x u=%d p=%08x Nc=%d Na=%d f=%02x",
+ TP_printk("%s c=%08x u=%d",
__print_symbolic(__entry->where, fscache_cookie_traces),
- __entry->cookie, __entry->usage,
- __entry->parent, __entry->n_children, __entry->n_active,
- __entry->flags)
+ __entry->cookie, __entry->usage)
);
TRACE_EVENT(fscache_netfs,