mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Liu <liubaolin12138@163.com>
To: linkinjeon@kernel.org, hyc.lee@gmail.com
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org,
	Baolin Liu <liubaolin@kylinos.cn>
Subject: [PATCH v3 3/6] ntfs: report inode metadata errors to fsnotify
Date: Thu, 24 Sep 2026 17:00:59 +0800	[thread overview]
Message-ID: <20260924090102.2865942-4-liubaolin12138@163.com> (raw)
In-Reply-To: <20260924090102.2865942-1-liubaolin12138@163.com>

From: Baolin Liu <liubaolin@kylinos.cn>

Inode initialization, writeback and LogFile failures currently mark the
volume as having errors without notifying filesystem health monitors.

Report these failures against the affected VFS inode, using the base
inode for attribute and index inodes. Preserve the existing treatment of
allocation failures, unsupported formats and interrupted operations.
Do not propagate reporting state between inode and attribute operations;
fanotify can merge queued error events.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs/inode.c   | 12 ++++++++----
 fs/ntfs/logfile.c |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 9583b2c6c7a2..591aab2850be 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1257,7 +1257,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
 		ntfs_error(vol->sb,
 			"Failed with error code %i.  Marking corrupt inode 0x%llx as bad.  Run chkdsk.",
 			err, ni->mft_no);
-		NVolSetErrors(vol);
+		ntfs_report_file_metadata_error(vi, err);
 	}
 	return err;
 }
@@ -1486,7 +1486,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 			base_ni->mft_no);
 	if (err != -ENOENT && err != -ENOMEM &&
 	    err != -EINTR && err != -ERESTARTSYS)
-		NVolSetErrors(vol);
+		ntfs_report_file_metadata_error(base_vi, err);
 	return err;
 }
 
@@ -1741,7 +1741,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 			err, ni->mft_no, ni->name_len);
 	if (err != -EOPNOTSUPP && err != -ENOMEM &&
 	    err != -EINTR && err != -ERESTARTSYS)
-		NVolSetErrors(vol);
+		ntfs_report_file_metadata_error(base_vi, err);
 	return err;
 }
 
@@ -2898,7 +2898,10 @@ int __ntfs_write_inode(struct inode *vi, int sync)
 		mark_inode_dirty(vi);
 	else {
 		ntfs_error(vi->i_sb, "Failed (error %i):  Run chkdsk.", -err);
-		NVolSetErrors(ni->vol);
+		if (err != -EINTR && err != -ERESTARTSYS)
+			ntfs_report_file_metadata_error(vi, err);
+		else
+			NVolSetErrors(ni->vol);
 	}
 	if (need_iput)
 		iput(vi);
@@ -2967,6 +2970,7 @@ static struct ntfs_inode *ntfs_extent_inode_open(struct ntfs_inode *base_ni,
 			    seq_no != le16_to_cpu(ni_mrec->sequence_number)) {
 				ntfs_error(sb, "Found stale extent mft reference mft=%llu",
 						ni->mft_no);
+				ntfs_report_file_metadata_error(VFS_I(base_ni), -EIO);
 				unmap_mft_record(ni);
 				return ERR_PTR(-EIO);
 			}
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
index 1404664dacc0..6897faf849c1 100644
--- a/fs/ntfs/logfile.c
+++ b/fs/ntfs/logfile.c
@@ -768,7 +768,7 @@ bool ntfs_empty_logfile(struct inode *log_vi)
 rl_err:
 	ntfs_error(sb, "Runlist is corrupt.  Unmount and run chkdsk.");
 dirty_err:
-	NVolSetErrors(vol);
+	ntfs_report_file_metadata_error(log_vi, -EIO);
 	err = -EIO;
 err:
 	kvfree(empty_buf);
-- 
2.51.0


  parent reply	other threads:[~2026-09-24  9:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24  9:00 [PATCH v3 0/6] ntfs: report filesystem errors through fsnotify Baolin Liu
2026-09-24  9:00 ` [PATCH v3 1/6] ntfs: report allocation metadata errors to fsnotify Baolin Liu
2026-09-24  9:00 ` [PATCH v3 2/6] ntfs: report attribute " Baolin Liu
2026-09-24  9:00 ` Baolin Liu [this message]
2026-09-24  9:01 ` [PATCH v3 4/6] ntfs: report MFT metadata and recovery " Baolin Liu
2026-09-26  0:36   ` Hyunchul Lee
2026-09-26 12:43     ` liubaolin
2026-09-24  9:01 ` [PATCH v3 5/6] ntfs: report MFT writeback " Baolin Liu
2026-09-24  9:01 ` [PATCH v3 6/6] ntfs: report shutdown " Baolin Liu
2026-09-26  0:40   ` Hyunchul Lee
2026-09-26 12:52     ` liubaolin
2026-09-26  0:33 ` [PATCH v3 0/6] ntfs: report filesystem errors through fsnotify Hyunchul Lee
2026-09-26 13:49   ` liubaolin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260924090102.2865942-4-liubaolin12138@163.com \
    --to=liubaolin12138@163.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin@kylinos.cn \
    --cc=ntfs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®