]> git.ipfire.org Git - thirdparty/linux.git/commit
xfs: add media verification ioctl
authorDarrick J. Wong <djwong@kernel.org>
Wed, 21 Jan 2026 02:06:52 +0000 (18:06 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 21 Jan 2026 02:06:52 +0000 (18:06 -0800)
commitb8accfd65d31f25b9df15ec2419179b6fa0b21d5
tree87f0880ba1636a88774f1b28002aa0c4eb0e28a3
parent8b85dc4090e1c72c6d42acd823514cce67cd54fc
xfs: add media verification ioctl

Add a new privileged ioctl so that xfs_scrub can ask the kernel to
verify the media of the devices backing an xfs filesystem, and have any
resulting media errors reported to fsnotify and xfs_healer.

To accomplish this, the kernel allocates a folio between the base page
size and 1MB, and issues read IOs to a gradually incrementing range of
one of the storage devices underlying an xfs filesystem.  If any error
occurs, that raw error is reported to the calling process.  If the error
happens to be one of the ones that the kernel considers indicative of
data loss, then it will also be reported to xfs_healthmon and fsnotify.

Driving the verification from the kernel enables xfs (and by extension
xfs_scrub) to have precise control over the size and error handling of
IOs that are issued to the underlying block device, and to emit
notifications about problems to other relevant kernel subsystems
immediately.

Note that the caller is also allowed to reduce the size of the IO and
to ask for a relaxation period after each IO.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/Makefile
fs/xfs/libxfs/xfs_fs.h
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_trace.h
fs/xfs/xfs_verify_media.c [new file with mode: 0644]
fs/xfs/xfs_verify_media.h [new file with mode: 0644]