Re: [PATCH v3 0/6] ntfs: report filesystem errors through fsnotify
From: Hyunchul Lee
Date: Fri Sep 25 2026 - 20:33:46 EST
Hi Baolin,
2026년 9월 24일 (목) 오후 6:02, Baolin Liu <liubaolin12138@xxxxxxx>님이 작성:
>
> From: Baolin Liu <liubaolin@xxxxxxxxxx>
>
> Report NTFS metadata and shutdown errors through the generic filesystem
> error notification infrastructure. Use file-level events for errors
There appear to be several error paths that identify corruption
but don't call any report_*_error(). For example:
* ntfs_lookup_inode_by_example(), ntfs_ib_read(),
ntfs_read_iomap_begin_non_resident(), and etc.
> associated with an affected inode, and volume-level events for volume
> metadata and shutdown errors. Preserve the volume error flags and report
> failed recovery independently of the error that triggered it.
>
> Report errors where they are detected and leave queued event merging to
> fanotify. No error_reported state is carried through search contexts,
> mapping-pairs updates or MFT mappings, so releasing a context cannot lose
> that state or suppress a later rollback or restore failure.
>
> Changes since v2:
> - Follow Hyunchul Lee's suggestion to remove error_reported tracking and
> the reporting-aware mapping APIs throughout the series.
> - Report independent cluster, mapping-pairs, ATTRIBUTE_LIST and MFT
> bitmap recovery failures while preserving the original operation errno.
> - Base the series on ntfs-next at 401898d748fc ("ntfs: validate
> attribute-list sizes before allocation"). Retain its MFT parent BIO
> and folio writeback implementation. Report synchronous and asynchronous
> device errors in the existing completion callback; fserror itself
> defers notification work and holds the inode reference. No additional
> NTFS completion workqueue or pending-I/O counter is introduced.
> - Cover stale extent references, failed extent-record cleanup, mirror
> failures and MFT preparation errors. Resolve attribute-inode reports
> to their base inode and keep cluster-free counts in 64-bit variables.
> - Split MFT reporting into two patches: metadata validation, allocation
> and recovery in patch 4; write preparation, mirror and BIO completion
> errors in patch 5. This keeps the two review topics separate.
> Shutdown reporting is now patch 6.
>
> Testing on this base:
> - QEMU passed mount/read/write/fsync/truncate/xattr/rename/unlink, MFT
> growth and unmount without FAN_FS_ERROR events during normal operation.
> - Verified EIO with a valid FID for file MFT corruption, EUCLEAN without
> a valid FID for an MFT bitmap mismatch, and ESHUTDOWN for forced
> shutdown.
> - Fault injection of an initial mapping-pairs error followed by an
> independent restore failure produced a merged FAN_FS_ERROR event with
> error_count=2. Synchronous and asynchronous MFT completion failures
> also generated notifications. The injection code is test-only and is
> excluded from the series.
>
> Baolin Liu (6):
> ntfs: report allocation metadata errors to fsnotify
> ntfs: report attribute errors to fsnotify
> ntfs: report inode metadata errors to fsnotify
> ntfs: report MFT metadata and recovery errors to fsnotify
> ntfs: report MFT writeback errors to fsnotify
> ntfs: report shutdown errors to fsnotify
>
> fs/ntfs/attrib.c | 84 ++++++++++++++------
> fs/ntfs/attrlist.c | 17 ++--
> fs/ntfs/bitmap.c | 2 +-
> fs/ntfs/inode.c | 12 ++-
> fs/ntfs/lcnalloc.c | 4 +-
> fs/ntfs/logfile.c | 2 +-
> fs/ntfs/mft.c | 192 ++++++++++++++++++++++++++++-----------------
> fs/ntfs/super.c | 32 +++++++-
> fs/ntfs/volume.h | 4 +
> 9 files changed, 235 insertions(+), 114 deletions(-)
>
> --
> 2.51.0
>
--
Thanks,
Hyunchul