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

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

index 784b314263a3951d6bd2f7ee3e0796d5cb5f0efc..d91712b9fbb00619b94e81bb851134817b679de6 100644 (file)
@@ -39,6 +39,9 @@
                },
                {
                        "$ref": "#/$events/media_error"
+               },
+               {
+                       "$ref": "#/$events/file_ioerror"
                }
        ],
 
                        "description": "Inode generation number",
                        "type": "integer"
                },
+               "off_t": {
+                       "description": "File position, in bytes",
+                       "type": "integer",
+                       "minimum": 0
+               },
+               "size_t": {
+                       "description": "File operation length, in bytes",
+                       "type": "integer",
+                       "minimum": 1
+               },
                "storage_devs": {
                        "description": "Storage devices in a filesystem",
                        "_comment": [
                }
        },
 
+       "$comment": "File IO event data are defined here.",
+       "$fileio": {
+               "types": {
+                       "description": [
+                               "File I/O operations.  One of:",
+                               "",
+                               " * readahead: reads into the page cache.",
+                               " * writeback: writeback of dirty page cache.",
+                               " * dioread:   O_DIRECT reads.",
+                               " * diowrite:  O_DIRECT writes."
+                       ],
+                       "enum": [
+                               "readahead",
+                               "writeback",
+                               "dioread",
+                               "diowrite"
+                       ]
+               }
+       },
+
        "$comment": "Event types are defined here.",
        "$events": {
                "lost": {
                                "daddr",
                                "bbcount"
                        ]
+               },
+               "file_ioerror": {
+                       "title": "File I/O error",
+                       "description": [
+                               "A read or a write to a file failed.  The",
+                               "inode, generation, pos, and len fields",
+                               "describe the range of the file that is",
+                               "affected."
+                       ],
+                       "type": "object",
+
+                       "properties": {
+                               "type": {
+                                       "$ref": "#/$fileio/types"
+                               },
+                               "time_ns": {
+                                       "$ref": "#/$defs/time_ns"
+                               },
+                               "domain": {
+                                       "const": "filerange"
+                               },
+                               "inumber": {
+                                       "$ref": "#/$defs/xfs_ino_t"
+                               },
+                               "generation": {
+                                       "$ref": "#/$defs/i_generation"
+                               },
+                               "pos": {
+                                       "$ref": "#/$defs/off_t"
+                               },
+                               "len": {
+                                       "$ref": "#/$defs/size_t"
+                               }
+                       },
+
+                       "required": [
+                               "type",
+                               "time_ns",
+                               "domain",
+                               "inumber",
+                               "generation",
+                               "pos",
+                               "len"
+                       ]
                }
        }
 }