diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-09-08 04:25:32 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:12 +0300 |
commit | caaa66aa546a27e75fb3cf32df1906140f85f1c9 (patch) | |
tree | 670ae5eefa4a486f94181b84108e9f562f1a7a88 /fs/bcachefs/trace.h | |
parent | b301105b48d2805ca0e29b1b0f660cf2232511ee (diff) | |
download | linux-caaa66aa546a27e75fb3cf32df1906140f85f1c9.tar.xz |
bcachefs: Better approach to write vs. read lock deadlocks
Instead of unconditionally upgrading read locks to intent locks in
do_bch2_trans_commit(), this patch changes the path that takes write
locks to first trylock, and then if trylock fails check if we have a
conflicting read lock, and restart the transaction if necessary.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/trace.h')
-rw-r--r-- | fs/bcachefs/trace.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h index 960dcc8ce3e6..21d026277540 100644 --- a/fs/bcachefs/trace.h +++ b/fs/bcachefs/trace.h @@ -756,6 +756,21 @@ TRACE_EVENT(trans_restart_would_deadlock, __entry->want_pos_snapshot) ); +TRACE_EVENT(trans_restart_would_deadlock_write, + TP_PROTO(unsigned long trans_ip), + TP_ARGS(trans_ip), + + TP_STRUCT__entry( + __field(unsigned long, trans_ip ) + ), + + TP_fast_assign( + __entry->trans_ip = trans_ip; + ), + + TP_printk("%ps", (void *) __entry->trans_ip) +); + TRACE_EVENT(trans_restart_mem_realloced, TP_PROTO(unsigned long trans_ip, unsigned long caller_ip, unsigned long bytes), |