]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: report shutdown events through healthmon
authorDarrick J. Wong <djwong@kernel.org>
Wed, 7 Aug 2024 22:54:55 +0000 (15:54 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 14 Aug 2024 03:08:26 +0000 (20:08 -0700)
Set up a shutdown hook so that we can send notifications to userspace.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_healthmon.schema.json

index 1f43bb3850b11f973e26dee898f135099305aec6..495d868ddea291bcad61f6e860fe9373ef19c176 100644 (file)
@@ -33,6 +33,9 @@
                },
                {
                        "$ref": "#/$events/inode_metadata"
+               },
+               {
+                       "$ref": "#/$events/shutdown"
                }
        ],
 
                }
        },
 
+       "$comment": "Shutdown event data are defined here.",
+       "$shutdown": {
+               "reason": {
+                       "description": [
+                               "Reason for a filesystem to shut down.",
+                               "Options include:",
+                               "",
+                               " * corrupt_incore: in-memory corruption",
+                               " * corrupt_ondisk: on-disk corruption",
+                               " * device_removed: device removed",
+                               " * force_umount:   userspace asked for it",
+                               " * log_ioerr:      log write IO error",
+                               " * meta_ioerr:     metadata writeback IO error"
+                       ],
+                       "enum": [
+                               "corrupt_incore",
+                               "corrupt_ondisk",
+                               "device_removed",
+                               "force_umount",
+                               "log_ioerr",
+                               "meta_ioerr"
+                       ]
+               }
+       },
+
        "$comment": "Event types are defined here.",
        "$events": {
                "lost": {
                                "generation",
                                "structures"
                        ]
+               },
+               "shutdown": {
+                       "title": "Abnormal Shutdown Event",
+                       "description": [
+                               "The filesystem went offline due to",
+                               "unrecoverable errors."
+                       ],
+                       "type": "object",
+
+                       "properties": {
+                               "type": {
+                                       "const": "shutdown"
+                               },
+                               "time_ns": {
+                                       "$ref": "#/$defs/time_ns"
+                               },
+                               "domain": {
+                                       "const": "mount"
+                               },
+                               "reasons": {
+                                       "type": "array",
+                                       "items": {
+                                               "$ref": "#/$shutdown/reason"
+                                       },
+                                       "minItems": 1
+                               }
+                       },
+
+                       "required": [
+                               "type",
+                               "time_ns",
+                               "domain",
+                               "reasons"
+                       ]
                }
        }
 }