diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-02 01:41:08 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-03 23:55:58 -0400 |
commit | e14a32fd7fd1330b668f6237ffbb718c6f1cf97f (patch) | |
tree | c4440f71055576c74969b3c502092ef5a3b06d0e /fs/bcachefs/debug.c | |
parent | 120984ab424bcd17b831b7cf0aa2648492212d2b (diff) |
bcachefs: Improve btree_deadlock debugfs output
This changes bch2_check_for_deadlock() to print the longest chains it
finds - when we have a deadlock because the cycle detector isn't finding
something, this will let us see what it's missing.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/debug.c')
-rw-r--r-- | fs/bcachefs/debug.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c index bff5e9b6ddef..1d2a16155073 100644 --- a/fs/bcachefs/debug.c +++ b/fs/bcachefs/debug.c @@ -724,11 +724,18 @@ static ssize_t bch2_btree_deadlock_read(struct file *file, char __user *buf, goto out; mutex_lock(&c->btree_trans_lock); - list_for_each_entry(trans, &c->btree_trans_list, list) - if (bch2_check_for_deadlock(trans, &i->buf)) { - i->iter = 1; - break; - } + list_for_each_entry(trans, &c->btree_trans_list, list) { + if (trans->locking_wait.task->pid <= i->iter) + continue; + + ret = flush_buf(i); + if (ret) + return ret; + + bch2_check_for_deadlock(trans, &i->buf); + + i->iter = trans->locking_wait.task->pid; + } mutex_unlock(&c->btree_trans_lock); out: if (i->buf.allocation_failure) |