* [PATCH] ntfs: mount hibernated volumes read-only regardless of errors=
@ 2026-09-14 3:42 Hongling Zeng
2026-09-14 4:16 ` liubaolin
2026-09-14 13:59 ` Namjae Jeon
0 siblings, 2 replies; 4+ messages in thread
From: Hongling Zeng @ 2026-09-14 3:42 UTC (permalink / raw)
To: linkinjeon, hyc.lee
Cc: ntfs, linux-kernel, zhongling0719, Hongling Zeng, stable
The hibernation check in load_system_files() only converts the
superblock to read-only under errors=remount-ro. With the default
errors=continue (and with errors=panic), a hibernated volume is
mounted read-write and the mount-time $LogFile emptying writes to it,
although a hibernated volume must not be written to at all.
Drop the on_errors term so that a hibernated volume, or a volume whose
hibernation state cannot be determined, always mounts read-only.
NVolErrors() is still recorded, so ntfs_reconfigure() keeps refusing
remounts to read-write, and the $LogFile emptying is skipped by its
!sb_rdonly() check.
Cc: stable@vger.kernel.org
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
---
fs/ntfs/super.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 2d4132aa39d3..fd7e5dbd1115 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1660,8 +1660,13 @@ static bool load_system_files(struct ntfs_volume *vol)
const char *es1;
es1 = err < 0 ? es1a : es1b;
- /* If a read-write mount, convert it to a read-only mount. */
- if (!sb_rdonly(sb) && vol->on_errors == ON_ERRORS_REMOUNT_RO) {
+ /*
+ * A Windows hibernation image is not a filesystem error, so
+ * this is a safety interlock rather than something the
+ * errors= policy may downgrade: always convert a read-write
+ * mount to read-only.
+ */
+ if (!sb_rdonly(sb)) {
sb->s_flags |= SB_RDONLY;
ntfs_error(sb, "%s. Mounting read-only%s", es1, es2);
}
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ntfs: mount hibernated volumes read-only regardless of errors=
2026-09-14 3:42 [PATCH] ntfs: mount hibernated volumes read-only regardless of errors= Hongling Zeng
@ 2026-09-14 4:16 ` liubaolin
2026-09-14 13:59 ` Namjae Jeon
1 sibling, 0 replies; 4+ messages in thread
From: liubaolin @ 2026-09-14 4:16 UTC (permalink / raw)
To: Hongling Zeng, linkinjeon, hyc.lee
Cc: ntfs, linux-kernel, zhongling0719, stable
在 2026/9/14 11:42, Hongling Zeng 写道:
> The hibernation check in load_system_files() only converts the
> superblock to read-only under errors=remount-ro. With the default
> errors=continue (and with errors=panic), a hibernated volume is
> mounted read-write and the mount-time $LogFile emptying writes to it,
> although a hibernated volume must not be written to at all.
>
> Drop the on_errors term so that a hibernated volume, or a volume whose
> hibernation state cannot be determined, always mounts read-only.
> NVolErrors() is still recorded, so ntfs_reconfigure() keeps refusing
> remounts to read-write, and the $LogFile emptying is skipped by its
> !sb_rdonly() check.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
> fs/ntfs/super.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
> index 2d4132aa39d3..fd7e5dbd1115 100644
> --- a/fs/ntfs/super.c
> +++ b/fs/ntfs/super.c
> @@ -1660,8 +1660,13 @@ static bool load_system_files(struct ntfs_volume *vol)
> const char *es1;
>
> es1 = err < 0 ? es1a : es1b;
> - /* If a read-write mount, convert it to a read-only mount. */
> - if (!sb_rdonly(sb) && vol->on_errors == ON_ERRORS_REMOUNT_RO) {
> + /*
> + * A Windows hibernation image is not a filesystem error, so
> + * this is a safety interlock rather than something the
> + * errors= policy may downgrade: always convert a read-write
> + * mount to read-only.
> + */
> + if (!sb_rdonly(sb)) {
> sb->s_flags |= SB_RDONLY;
> ntfs_error(sb, "%s. Mounting read-only%s", es1, es2);
> }
Looks good to me.
Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ntfs: mount hibernated volumes read-only regardless of errors=
2026-09-14 3:42 [PATCH] ntfs: mount hibernated volumes read-only regardless of errors= Hongling Zeng
2026-09-14 4:16 ` liubaolin
@ 2026-09-14 13:59 ` Namjae Jeon
2026-09-15 1:05 ` dd
1 sibling, 1 reply; 4+ messages in thread
From: Namjae Jeon @ 2026-09-14 13:59 UTC (permalink / raw)
To: Hongling Zeng; +Cc: hyc.lee, ntfs, linux-kernel, zhongling0719, stable
On Mon, Sep 14, 2026 at 12:42 PM Hongling Zeng <zenghongling@kylinos.cn> wrote:
>
> The hibernation check in load_system_files() only converts the
> superblock to read-only under errors=remount-ro. With the default
> errors=continue (and with errors=panic), a hibernated volume is
> mounted read-write and the mount-time $LogFile emptying writes to it,
> although a hibernated volume must not be written to at all.
>
> Drop the on_errors term so that a hibernated volume, or a volume whose
> hibernation state cannot be determined, always mounts read-only.
> NVolErrors() is still recorded, so ntfs_reconfigure() keeps refusing
> remounts to read-write, and the $LogFile emptying is skipped by its
> !sb_rdonly() check.
check_windows_hibernation_status() calls ntfs_error() before SB_RDONLY
is set. With errors=panic, this panics before reaching the new
read-only fallback...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re:Re: [PATCH] ntfs: mount hibernated volumes read-only regardless of errors=
2026-09-14 13:59 ` Namjae Jeon
@ 2026-09-15 1:05 ` dd
0 siblings, 0 replies; 4+ messages in thread
From: dd @ 2026-09-15 1:05 UTC (permalink / raw)
To: Namjae Jeon; +Cc: Hongling Zeng, hyc.lee, ntfs, linux-kernel, stable
在 2026-09-14 21:59:10,"Namjae Jeon" <linkinjeon@kernel.org> 写道:
>On Mon, Sep 14, 2026 at 12:42 PM Hongling Zeng <zenghongling@kylinos.cn> wrote:
>>
>> The hibernation check in load_system_files() only converts the
>> superblock to read-only under errors=remount-ro. With the default
>> errors=continue (and with errors=panic), a hibernated volume is
>> mounted read-write and the mount-time $LogFile emptying writes to it,
>> although a hibernated volume must not be written to at all.
>>
>> Drop the on_errors term so that a hibernated volume, or a volume whose
>> hibernation state cannot be determined, always mounts read-only.
>> NVolErrors() is still recorded, so ntfs_reconfigure() keeps refusing
>> remounts to read-write, and the $LogFile emptying is skipped by its
>> !sb_rdonly() check.
>check_windows_hibernation_status() calls ntfs_error() before SB_RDONLY
>is set. With errors=panic, this panics before reaching the new
>read-only fallback...
Thanks for catching this. Right -- those error paths call ntfs_error()
before SB_RDONLY is set, so errors=panic can fire inside
check_windows_hibernation_status().
I will remove the internal ntfs_error() calls in v2; the caller already
reports "Failed to determine if Windows is hibernated." for every
err < 0 case. NVolErrors() is still recorded, so ntfs_reconfigure()
keeps rejecting remounts to read-write.
Thanks,
Hongling
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-15 1:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 3:42 [PATCH] ntfs: mount hibernated volumes read-only regardless of errors= Hongling Zeng
2026-09-14 4:16 ` liubaolin
2026-09-14 13:59 ` Namjae Jeon
2026-09-15 1:05 ` dd
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®