fscache: Fix fscache_cookie_put() to not deref after dec
authorDavid Howells <dhowells@redhat.com>
Fri, 18 Jun 2021 10:19:49 +0000 (11:19 +0100)
committerDavid Howells <dhowells@redhat.com>
Fri, 27 Aug 2021 12:34:02 +0000 (13:34 +0100)
commit33cba859220b0878b3b2931caa1629a3d2432379
tree16479e10dd084bd8193cf70946bfe8367a127c9a
parent35b72573e977ed6b18b094136a4fa3e0ffb13603
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/
fs/fscache/cookie.c
fs/fscache/internal.h
fs/fscache/netfs.c
include/trace/events/fscache.h