summaryrefslogtreecommitdiff
path: root/fs/bcachefs/trace.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-02-27 19:34:21 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:26 +0300
commitddf11d8c60b0d46dd25520d388243b508d6e9016 (patch)
tree41932cd7dbe9538f62da918e379832cabbaf1b1c /fs/bcachefs/trace.h
parent7db4cbd0a52554ddec4cabf2ebd69fc7bcd53a31 (diff)
downloadlinux-ddf11d8c60b0d46dd25520d388243b508d6e9016.tar.xz
bcachefs: Fix a use after free
This fixes a regression from "bcachefs: Stash a copy of key being overwritten in btree_insert_entry". In btree_key_can_insert_cached(), we may reallocate the key cache key, invalidating pointers previously returned by peek() - fix it by issuing a transaction restart. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/trace.h')
-rw-r--r--fs/bcachefs/trace.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h
index b35022dc66c2..af3785254c71 100644
--- a/fs/bcachefs/trace.h
+++ b/fs/bcachefs/trace.h
@@ -918,6 +918,14 @@ TRACE_EVENT(trans_restart_mem_realloced,
__entry->bytes)
);
+DEFINE_EVENT(transaction_restart_iter, trans_restart_key_cache_key_realloced,
+ TP_PROTO(const char *trans_fn,
+ unsigned long caller_ip,
+ enum btree_id btree_id,
+ struct bpos *pos),
+ TP_ARGS(trans_fn, caller_ip, btree_id, pos)
+);
+
#endif /* _TRACE_BCACHEFS_H */
/* This part must be outside protection */