Hi all, This patchset builds off of Kent Overstreet's thread_with_file code to deliver live information about filesystem health events to userspace. This is done by creating a twf file and hooking internal operations so that the event information can be queued to the twf without stalling the kernel if the twf client program is nonresponsive. This is a private ioctl, so events are expressed using simple json objects so that we can enrich the output later on without having to rev a ton of C structs. In userspace, we create a new daemon program that will read the json event objects and initiate repairs automatically. This daemon is managed entirely by systemd and will not block unmounting of the filesystem unless repairs are ongoing. It is autostarted via some horrible udev rules. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=health-monitoring xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=health-monitoring fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=health-monitoring --- Commits in this patchset: * xfs: use thread_with_file to create a monitoring file * xfs: create hooks for monitoring health updates * xfs: report shutdown events through healthmon * xfs_io: monitor filesystem health events * xfs_scrubbed: create daemon to listen for health events * xfs_scrubbed: enable repairing filesystems * xfs_scrubbed: create a background monitoring service --- io/Makefile | 1 io/healthmon.c | 172 +++++++++++++ io/init.c | 1 io/io.h | 1 libxfs/xfs_fs.h | 1 libxfs/xfs_fs_staging.h | 18 + libxfs/xfs_health.h | 48 ++++ man/man8/xfs_io.8 | 22 ++ scrub/Makefile | 23 +- scrub/xfs.rules | 3 scrub/xfs_scrubbed.in | 519 ++++++++++++++++++++++++++++++++++++++++ scrub/xfs_scrubbed@xxxxxxxxxxx | 95 +++++++ scrub/xfs_scrubbed_start | 17 + 13 files changed, 916 insertions(+), 5 deletions(-) create mode 100644 io/healthmon.c create mode 100644 scrub/xfs_scrubbed.in create mode 100644 scrub/xfs_scrubbed@xxxxxxxxxxx create mode 100755 scrub/xfs_scrubbed_start