[PATCH v3 6/6] ntfs: report shutdown errors to fsnotify

From: Baolin Liu

Date: Thu Sep 24 2026 - 05:04:57 EST


From: Baolin Liu <liubaolin@xxxxxxxxxx>

Notify FAN_FS_ERROR listeners when NTFS enters forced shutdown after
FS_IOC_SHUTDOWN or backing-device removal. Keep the shutdown state
transition and notification together in a dedicated helper.

Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
---
fs/ntfs/super.c | 12 +++++++++---
fs/ntfs/volume.h | 1 +
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index a7a7ecf9d074..a0d3934ef6c8 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -414,6 +414,12 @@ void ntfs_report_file_metadata_error(struct inode *inode, int error)
fserror_report_file_metadata(inode, error, GFP_ATOMIC);
}

+void ntfs_report_shutdown(struct ntfs_volume *vol)
+{
+ NVolSetShutdown(vol);
+ fserror_report_shutdown(vol->sb, GFP_ATOMIC);
+}
+
void ntfs_handle_error(struct super_block *sb)
{
struct ntfs_volume *vol = NTFS_SB(sb);
@@ -430,7 +436,7 @@ void ntfs_handle_error(struct super_block *sb)
sb->s_id);
} else if (vol->on_errors == ON_ERRORS_CONTINUE) {
if (errseq_check(&sb->s_wb_err, vol->wb_err) == -ENODEV) {
- NVolSetShutdown(vol);
+ ntfs_report_shutdown(vol);
vol->wb_err = sb->s_wb_err;
}
}
@@ -2086,10 +2092,10 @@ int ntfs_force_shutdown(struct super_block *sb, u32 flags)
if (ret)
return ret;
bdev_thaw(sb->s_bdev);
- NVolSetShutdown(vol);
+ ntfs_report_shutdown(vol);
break;
case FS_SHUTDOWN_FLAGS_NOLOGFLUSH:
- NVolSetShutdown(vol);
+ ntfs_report_shutdown(vol);
break;
default:
return -EINVAL;
diff --git a/fs/ntfs/volume.h b/fs/ntfs/volume.h
index 366e9f5d0443..648fe8991304 100644
--- a/fs/ntfs/volume.h
+++ b/fs/ntfs/volume.h
@@ -256,6 +256,7 @@ DEFINE_NVOL_BIT_OPS(SymlinkNative)

void ntfs_report_metadata_error(struct ntfs_volume *vol, int error);
void ntfs_report_file_metadata_error(struct inode *inode, int error);
+void ntfs_report_shutdown(struct ntfs_volume *vol);

static inline void ntfs_inc_free_clusters(struct ntfs_volume *vol, s64 nr)
{
--
2.51.0