Commit 479c6412 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Dave Chinner

xfs: enable buffer deadlock postmortem diagnosis via ftrace

Create a second buf_trylock tracepoint so that we can distinguish
between a successful and a failed trylock.  With this piece, we can
use a script to look at the ftrace output to detect buffer deadlocks.

[dchinner: update to if/else as per hch's suggestion]
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 3f94c441
...@@ -944,10 +944,12 @@ xfs_buf_trylock( ...@@ -944,10 +944,12 @@ xfs_buf_trylock(
int locked; int locked;
locked = down_trylock(&bp->b_sema) == 0; locked = down_trylock(&bp->b_sema) == 0;
if (locked) if (locked) {
XB_SET_OWNER(bp); XB_SET_OWNER(bp);
trace_xfs_buf_trylock(bp, _RET_IP_);
trace_xfs_buf_trylock(bp, _RET_IP_); } else {
trace_xfs_buf_trylock_fail(bp, _RET_IP_);
}
return locked; return locked;
} }
......
...@@ -354,6 +354,7 @@ DEFINE_BUF_EVENT(xfs_buf_submit_wait); ...@@ -354,6 +354,7 @@ DEFINE_BUF_EVENT(xfs_buf_submit_wait);
DEFINE_BUF_EVENT(xfs_buf_bawrite); DEFINE_BUF_EVENT(xfs_buf_bawrite);
DEFINE_BUF_EVENT(xfs_buf_lock); DEFINE_BUF_EVENT(xfs_buf_lock);
DEFINE_BUF_EVENT(xfs_buf_lock_done); DEFINE_BUF_EVENT(xfs_buf_lock_done);
DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
DEFINE_BUF_EVENT(xfs_buf_trylock); DEFINE_BUF_EVENT(xfs_buf_trylock);
DEFINE_BUF_EVENT(xfs_buf_unlock); DEFINE_BUF_EVENT(xfs_buf_unlock);
DEFINE_BUF_EVENT(xfs_buf_iowait); DEFINE_BUF_EVENT(xfs_buf_iowait);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment