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, Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH v3 6/6] ntfs: report shutdown errors to fsnotify
Date: Sat, 26 Sep 2026 20:52:32 +0800 [thread overview]
Message-ID: <285c4581-ee1b-4963-9741-ed44c9ad2583@163.com> (raw)
In-Reply-To: <CANFS6baY+nbdzux-pF-MZ+8ryP8Q34RyO0Rh4qVR7rqvjsPHbg@mail.gmail.com>
在 2026/9/26 08:40, Hyunchul Lee 写道:
> 2026년 9월 24일 (목) 오후 6:02, Baolin Liu <liubaolin12138@163.com>님이 작성:
>>
>> From: Baolin Liu <liubaolin@kylinos.cn>
>>
>> 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@kylinos.cn>
>> ---
>> 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);
>
> Could we call test_and_set(NV_Shutdown, &vol->flags)
> to avoid races?
Hi Hyunchul,
Thank you for pointing this out. I'll use test_and_set_bit() in v4
to avoid duplicate shutdown notifications from concurrent callers.
Thanks,
Baolin.
>
>
>> + fserror_report_shutdown(vol->sb, GFP_ATOMIC);
>> +}
>
> we can avoid test_and_set() to prevent race
>
>
>> +
>> 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
>>
>
>
> --
> Thanks,
> Hyunchul
next prev parent reply other threads:[~2026-09-26 12:53 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 ` [PATCH v3 3/6] ntfs: report inode metadata " Baolin Liu
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 [this message]
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=285c4581-ee1b-4963-9741-ed44c9ad2583@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®