Re: [PATCH v1 1/2] ntfs: report volume errors to fsnotify

From: Hyunchul Lee

Date: Mon Aug 31 2026 - 02:41:16 EST


Hi Baolin,

2026년 8월 26일 (수) 오후 9:28, Baolin Liu <liubaolin12138@xxxxxxx>님이 작성:
>
> From: Baolin Liu <liubaolin@xxxxxxxxxx>
>
> The ntfs driver reports volume corruption only to dmesg. Wire up the
> generic fserror infrastructure at NVolSetErrors(), the point where the
> driver concludes the volume metadata is inconsistent, so that an
> FS_ERROR event is emitted as well. This lets health monitoring daemons
> watching the mount with fanotify(FAN_FS_ERROR) learn about corruption
> without scraping kernel logs.
>
> Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
> ---
> fs/ntfs/super.c | 8 ++++++++
> fs/ntfs/volume.h | 14 +++++++++++++-
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
> index cd8fa2c13370..5229eb27bb30 100644
> --- a/fs/ntfs/super.c
> +++ b/fs/ntfs/super.c
> @@ -14,6 +14,7 @@
> #include <linux/sched/mm.h>
> #include <linux/fs_context.h>
> #include <linux/fs_parser.h>
> +#include <linux/fserror.h>
>
> #include "sysctl.h"
> #include "logfile.h"
> @@ -330,6 +331,13 @@ const struct option_t on_errors_arr[] = {
> { 0, NULL }
> };
>
> +/* Mark the volume as corrupt and notify fanotify(FAN_FS_ERROR) listeners. */
> +void NVolSetErrors(struct ntfs_volume *vol)
> +{
> + set_bit(NV_Errors, &vol->flags);
> + fserror_report_metadata(vol->sb, -EFSCORRUPTED, GFP_ATOMIC);
> +}

NVolSetErrors() is also reached when some functions
return -EIO. Could you preserve the original errno?

And in some situations, fserror_report_file_metadata()
can be useful instead of fserror_report_metadata().

--
Thanks,
Hyunchul