mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liubaolin <liubaolin12138@163.com>
To: Hyunchul Lee <hyc.lee@gmail.com>
Cc: linkinjeon@kernel.org, ntfs@lists.linux.dev,
	linux-kernel@vger.kernel.org, liubaolin12138@gmail.com,
	Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH v1 1/2] ntfs: report volume errors to fsnotify
Date: Tue, 1 Sep 2026 17:48:22 +0800	[thread overview]
Message-ID: <cbe8b022-dbe0-4696-8a97-633ee9ba664b@163.com> (raw)
In-Reply-To: <CANFS6ba-=yXwSrA+NGnnZ84Yffmm-gNrAWEWpyjdC5fazWSXxw@mail.gmail.com>



在 2026/8/31 14:38, Hyunchul Lee 写道:
> Hi Baolin,
> 
> 2026년 8월 26일 (수) 오후 9:28, Baolin Liu <liubaolin12138@163.com>님이 작성:
>>
>> From: Baolin Liu <liubaolin@kylinos.cn>
>>
>> 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@kylinos.cn>
>> ---
>>   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().
> 

Hi Hyunchul,

   You are right, reporting -EFSCORRUPTED unconditionally loses that
   distinction - a media failure and genuine metadata corruption should 
not look the same to a listener.
   Agreed on fserror_report_file_metadata() too, several call sites do 
have the inode at hand.

   I will rework the implementation along both lines and send a v2.
   Thanks for the review.

Thanks,
Baolin


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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 12:27 [PATCH v1 0/2] ntfs: report filesystem " Baolin Liu
2026-08-26 12:27 ` [PATCH v1 1/2] ntfs: report volume " Baolin Liu
2026-08-31  6:38   ` Hyunchul Lee
2026-09-01  9:48     ` liubaolin [this message]
2026-08-26 12:27 ` [PATCH v1 2/2] ntfs: report forced shutdown " Baolin Liu

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=cbe8b022-dbe0-4696-8a97-633ee9ba664b@163.com \
    --to=liubaolin12138@163.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin12138@gmail.com \
    --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®