1 .. SPDX-License-Identifier: GPL-2.0 2 3 ==================================== 4 File system Monitoring with fanotify 5 ==================================== 6 7 File system Error Reporting 8 =========================== 9 10 Fanotify supports the FAN_FS_ERROR event type 11 reporting. It is meant to be used by file sys 12 daemons, which listen for these events and tak 13 sysadmin, start recovery) when a file system p 14 15 By design, a FAN_FS_ERROR notification exposes 16 for a monitoring tool to know a problem in the 17 It doesn't necessarily provide a user space ap 18 to verify an IO operation was successfully exe 19 scope for this feature. Instead, it is only m 20 early file system problem detection and report 21 22 When a file system operation fails, it is comm 23 errors to cascade after the initial failure, h 24 log, which is usually the most useful debug da 25 problem. For this reason, FAN_FS_ERROR tries 26 error that occurred for a file system since th 27 it simply counts additional errors. This ensu 28 important pieces of information are never lost 29 30 FAN_FS_ERROR requires the fanotify group to be 31 FAN_REPORT_FID flag. 32 33 At the time of this writing, the only file sys 34 notifications is Ext4. 35 36 A FAN_FS_ERROR Notification has the following 37 38 :: 39 40 [ Notification Metadata (Mandatory) ] 41 [ Generic Error Record (Mandatory) ] 42 [ FID record (Mandatory) ] 43 44 The order of records is not guaranteed, and ne 45 in the future. Therefore, applications must n 46 must be prepared to skip over unknown records. 47 ``samples/fanotify/fs-monitor.c`` for an examp 48 49 Generic error record 50 -------------------- 51 52 The generic error record provides enough infor 53 agnostic tool to learn about a problem in the 54 providing any additional details about the pro 55 identified by ``struct fanotify_event_info_hea 56 to FAN_EVENT_INFO_TYPE_ERROR. 57 58 :: 59 60 struct fanotify_event_info_error { 61 struct fanotify_event_info_header hd 62 __s32 error; 63 __u32 error_count; 64 }; 65 66 The `error` field identifies the type of error 67 `error_count` tracks the number of errors that 68 suppressed to preserve the original error info 69 notification. 70 71 FID record 72 ---------- 73 74 The FID record can be used to uniquely identif 75 the error through the combination of fsid and 76 specific application can use that information 77 procedure. Errors that are not related to an 78 empty file handle of type FILEID_INVALID.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.