From nobody Fri Sep 25 08:47:52 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 311F136167B; Tue, 15 Sep 2026 02:38:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789439921; cv=none; b=IpUCRmYzF4vavTkEIEd16hl9Ev1p8pb4xEjEKkuPDLhHZbwU/kJGdhBJwYBtao530C8I2p/3YXE+LBI3dqUX33GIpsq4S0tAF65FTb0L8oPrZ1XylZHrVGUfc/W7vZc/rXjBbpIDB06UDAbjDzELU+gW/+XY54WGuHQBeQNNYQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789439921; c=relaxed/simple; bh=sD0CbVZjYfuUt/1x+eCqpicKdhNo1b84q+U0C9cb7is=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BAVpMFECJJ5jH3xaiEMRDxWWUEOMF8GsA/o9Ywt+HURULP/1Dq3G8QolEqXrBHZI2NQrI+nAs0furlJc1TwXatihLFgNelnZ2lLQMGK42Ecem42VYi1JKSFCLE4QhwjbXaQfSOHikxoWRVgKbnb8hO3JssbftOO73Hw7A/Q/mQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 861834d0b0ae11f19a56ed5b684f684d-20260915 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.19,REQID:81b7f636-eab6-4434-a11c-21b69845b48c,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:7db8b62,CLOUDID:bebd3ff60e7db9e85ad101ac9f87eb23,BulkI D:nil,BulkQuantity:0,SF:102|136|850|865|898,TC:nil,Content:0|15|50|99,EDM: -3|-100,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,O SA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 861834d0b0ae11f19a56ed5b684f684d-20260915 X-User: zenghongling@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 319589923; Tue, 15 Sep 2026 10:38:24 +0800 From: Hongling Zeng To: linkinjeon@kernel.org, hyc.lee@gmail.com Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org, zhongling0719@126.com, Hongling Zeng , stable@vger.kernel.org Subject: [PATCH v3] ntfs: mount hibernated volumes read-only regardless of errors= Date: Tue, 15 Sep 2026 10:38:20 +0800 Message-Id: <20260915023820.621797-1-zenghongling@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The hibernation check in load_system_files() only converts the superblock to read-only under errors=3Dremount-ro. With the default errors=3Dcontinue (and with errors=3Dpanic), 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. Also change the ntfs_error() calls inside check_windows_hibernation_status() to ntfs_warning(): they run before SB_RDONLY is set, so errors=3Dpanic could panic there, while the warnings preserve diagnostics for already read-only mounts. The read-only fallback message is logged unconditionally: with SB_RDONLY set, or on an already read-only mount, ntfs_error() cannot panic, and the reason for NVolErrors() stays visible. Cc: stable@vger.kernel.org Signed-off-by: Hongling Zeng Reviewed-by: Baolin Liu --- Changes in v3: -Use ntfs_warning() for the hibernation diagnostics so that errors=3Dpanic cannot fire on this path. -Always log the read-only fallback message, including on already read-only mounts. --- fs/ntfs/super.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index f4a73e45773d..d1edf1a891e8 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -1169,7 +1169,7 @@ static int check_windows_hibernation_status(struct nt= fs_volume *vol) return 0; } /* A real error occurred. */ - ntfs_error(vol->sb, "Failed to find inode number for hiberfil.sys."); + ntfs_warning(vol->sb, "Failed to find inode number for hiberfil.sys."); return ret; } /* Get the inode. */ @@ -1177,7 +1177,7 @@ static int check_windows_hibernation_status(struct nt= fs_volume *vol) if (IS_ERR(vi)) { if (!IS_ERR(vi)) iput(vi); - ntfs_error(vol->sb, "Failed to load hiberfil.sys."); + ntfs_warning(vol->sb, "Failed to load hiberfil.sys."); return IS_ERR(vi) ? PTR_ERR(vi) : -EIO; } if (unlikely(i_size_read(vi) < NTFS_HIBERFIL_HEADER_SIZE)) { @@ -1188,7 +1188,7 @@ static int check_windows_hibernation_status(struct nt= fs_volume *vol) =20 folio =3D read_mapping_folio(vi->i_mapping, 0, NULL); if (IS_ERR(folio)) { - ntfs_error(vol->sb, "Failed to read from hiberfil.sys."); + ntfs_warning(vol->sb, "Failed to read from hiberfil.sys."); ret =3D PTR_ERR(folio); goto iput_out; } @@ -1581,11 +1581,16 @@ static bool load_system_files(struct ntfs_volume *v= ol) const char *es1; =20 es1 =3D err < 0 ? es1a : es1b; - /* If a read-write mount, convert it to a read-only mount. */ - if (!sb_rdonly(sb) && vol->on_errors =3D=3D ON_ERRORS_REMOUNT_RO) { + /* + * A Windows hibernation image is not a filesystem error, so + * this is a safety interlock rather than something the + * errors=3D policy may downgrade: always convert a read-write + * mount to read-only. + */ + if (!sb_rdonly(sb)) sb->s_flags |=3D SB_RDONLY; - ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); - } + + ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); NVolSetErrors(vol); } =20 --=20 2.25.1