]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: add tracepoints for stale pinned inode state debug
authorDave Chinner <dchinner@redhat.com>
Wed, 25 Jun 2025 22:48:57 +0000 (08:48 +1000)
committerCarlos Maiolino <cem@kernel.org>
Fri, 27 Jun 2025 12:14:37 +0000 (14:14 +0200)
I needed more insight into how stale inodes were getting stuck on
the AIL after a forced shutdown when running fsstress. These are the
tracepoints I added for that purpose.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_log_cil.c
fs/xfs/xfs_trace.h
fs/xfs/xfs_trans.c

index c6cb0b6b9e4605655b9b4de62d5e94c257f9c81b..285e27ff89e296daa60e49d1b7cf0df163f75bac 100644 (file)
@@ -758,11 +758,14 @@ xfs_inode_item_push(
                 * completed and items removed from the AIL before the next push
                 * attempt.
                 */
+               trace_xfs_inode_push_stale(ip, _RET_IP_);
                return XFS_ITEM_PINNED;
        }
 
-       if (xfs_ipincount(ip) > 0 || xfs_buf_ispinned(bp))
+       if (xfs_ipincount(ip) > 0 || xfs_buf_ispinned(bp)) {
+               trace_xfs_inode_push_pinned(ip, _RET_IP_);
                return XFS_ITEM_PINNED;
+       }
 
        if (xfs_iflags_test(ip, XFS_IFLUSHING))
                return XFS_ITEM_FLUSHING;
index f66d2d430e4f375f658ed2a39348359625b0bdee..a80cb6b9969a81f53c53a2a90a6cf80cd15d2cd6 100644 (file)
@@ -793,8 +793,10 @@ xlog_cil_ail_insert(
                struct xfs_log_item     *lip = lv->lv_item;
                xfs_lsn_t               item_lsn;
 
-               if (aborted)
+               if (aborted) {
+                       trace_xlog_ail_insert_abort(lip);
                        set_bit(XFS_LI_ABORTED, &lip->li_flags);
+               }
 
                if (lip->li_ops->flags & XFS_ITEM_RELEASE_WHEN_COMMITTED) {
                        lip->li_ops->iop_release(lip);
index 9f0d6bc966b745daa8b6d7fb31ef0f6131358929..ba45d801df1c75674b18ca5ec8cae5f339419519 100644 (file)
@@ -1146,6 +1146,7 @@ DECLARE_EVENT_CLASS(xfs_iref_class,
                __field(xfs_ino_t, ino)
                __field(int, count)
                __field(int, pincount)
+               __field(unsigned long, iflags)
                __field(unsigned long, caller_ip)
        ),
        TP_fast_assign(
@@ -1153,13 +1154,15 @@ DECLARE_EVENT_CLASS(xfs_iref_class,
                __entry->ino = ip->i_ino;
                __entry->count = atomic_read(&VFS_I(ip)->i_count);
                __entry->pincount = atomic_read(&ip->i_pincount);
+               __entry->iflags = ip->i_flags;
                __entry->caller_ip = caller_ip;
        ),
-       TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
+       TP_printk("dev %d:%d ino 0x%llx count %d pincount %d iflags 0x%lx caller %pS",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->ino,
                  __entry->count,
                  __entry->pincount,
+                 __entry->iflags,
                  (char *)__entry->caller_ip)
 )
 
@@ -1249,6 +1252,8 @@ DEFINE_IREF_EVENT(xfs_irele);
 DEFINE_IREF_EVENT(xfs_inode_pin);
 DEFINE_IREF_EVENT(xfs_inode_unpin);
 DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
+DEFINE_IREF_EVENT(xfs_inode_push_pinned);
+DEFINE_IREF_EVENT(xfs_inode_push_stale);
 
 DECLARE_EVENT_CLASS(xfs_namespace_class,
        TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name),
@@ -1653,6 +1658,8 @@ DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
 DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_mark);
 DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_skip);
 DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_unpin);
+DEFINE_LOG_ITEM_EVENT(xlog_ail_insert_abort);
+DEFINE_LOG_ITEM_EVENT(xfs_trans_free_abort);
 
 DECLARE_EVENT_CLASS(xfs_ail_class,
        TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
index c6657072361a479ee5abfe2d5b22dc5a0335193c..b4a07af513bada591b2b974699e174b8dc87dda7 100644 (file)
@@ -742,8 +742,10 @@ xfs_trans_free_items(
 
        list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) {
                xfs_trans_del_item(lip);
-               if (abort)
+               if (abort) {
+                       trace_xfs_trans_free_abort(lip);
                        set_bit(XFS_LI_ABORTED, &lip->li_flags);
+               }
                if (lip->li_ops->iop_release)
                        lip->li_ops->iop_release(lip);
        }