]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: convey filesystem shutdown events to the health monitor
authorDarrick J. Wong <djwong@kernel.org>
Sun, 22 Feb 2026 22:41:04 +0000 (14:41 -0800)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 8 Apr 2026 19:39:56 +0000 (21:39 +0200)
Source kernel commit: 74c4795e50f816dbf5cf094691fc4f95bbc729ad

Connect the filesystem shutdown code to the health monitor so that xfs
can send events about that to the xfs_healer daemon.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_fs.h

index 04e1dcf61257d0f89d51906106074d1b460a3118..c8f7011a7ef8efca3dda8917bfbed0ac4915053a 100644 (file)
@@ -1028,6 +1028,9 @@ struct xfs_rtgroup_geometry {
 #define XFS_HEALTH_MONITOR_TYPE_CORRUPT                (4)
 #define XFS_HEALTH_MONITOR_TYPE_HEALTHY                (5)
 
+/* filesystem shutdown */
+#define XFS_HEALTH_MONITOR_TYPE_SHUTDOWN       (6)
+
 /* lost events */
 struct xfs_health_monitor_lost {
        __u64   count;
@@ -1054,6 +1057,20 @@ struct xfs_health_monitor_inode {
        __u64   ino;
 };
 
+/* shutdown reasons */
+#define XFS_HEALTH_SHUTDOWN_META_IO_ERROR      (1u << 0)
+#define XFS_HEALTH_SHUTDOWN_LOG_IO_ERROR       (1u << 1)
+#define XFS_HEALTH_SHUTDOWN_FORCE_UMOUNT       (1u << 2)
+#define XFS_HEALTH_SHUTDOWN_CORRUPT_INCORE     (1u << 3)
+#define XFS_HEALTH_SHUTDOWN_CORRUPT_ONDISK     (1u << 4)
+#define XFS_HEALTH_SHUTDOWN_DEVICE_REMOVED     (1u << 5)
+
+/* shutdown */
+struct xfs_health_monitor_shutdown {
+       /* XFS_HEALTH_SHUTDOWN_* flags */
+       __u32   reasons;
+};
+
 struct xfs_health_monitor_event {
        /* XFS_HEALTH_MONITOR_DOMAIN_* */
        __u32   domain;
@@ -1074,6 +1091,7 @@ struct xfs_health_monitor_event {
                struct xfs_health_monitor_fs fs;
                struct xfs_health_monitor_group group;
                struct xfs_health_monitor_inode inode;
+               struct xfs_health_monitor_shutdown shutdown;
        } e;
 
        /* zeroes */