From nobody Tue May 12 19:00:51 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gFQsj3J54z6cw8D for ; Tue, 12 May 2026 19:00:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gFQsj0ckKz3PrM for ; Tue, 12 May 2026 19:00:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778612457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R8upLhb1GW/tXPKiUBgvs3DNgE5nmlLG/Y0lBoExM/s=; b=n9KVLb8GxEjNomRd9HRLkj7Fp3iLxj/fRNb+E1GE1qDPUs8L+TWVTI3eDEP+vma2YJUctu eCox2/9vGdu8LUoGrd7Di7KGhDk0bChW9WTdWxinS66O08MCvvy7SNocD5KW+9FAGz0bqd GLydHiwrZ6oGIe5JACN+rjSVnTUZTLGeJDYDc17JTAhfasZbWFSuQE+k7vQSYnxkRGZRhz sO4PQD8sl6L6ExLdjZBP9VOe9qcxgJqjtPrM0gCJzfF7lBUt2EoKWE9riu3dRwZ0PDMvfF EQuKDniSix+neKa1xbUCFswMcAiTG4lvu8WG+tm7GRi/IZbsMGXGQQY2Qbz8Sg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778612457; a=rsa-sha256; cv=none; b=hBrlsaLzUggIRi1Z4Vd8od5uMRcyPNO/OgsxRyQE+cZzKWIgB/Xw+n4oXM6NcMmI+IbjxP vgPy45AHXTc1Bdk8vAGCMasp/L0XWF5Ssd2QDKMB6j5TAsUVPV8WycoTI4siGidQlCrD+g JLW8HRmIGxOS+pBYf7lnLbtAyV1ASdipH0ST7uMgvmLfVCZwgIf5IrtdHR4yknkccilAzE 1SdRdxWVYIq8GEeSJICpSlndP82uAN4O9Zb2G1P6LQWpMsZX50n1AqV/Grv2W1g+8m0kJg QtJP/gvEN0npvEbzEU8d5NgjM9K2Y/aGXLG+Mz/47ayilseYEhKZvUot0DE3Zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778612457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R8upLhb1GW/tXPKiUBgvs3DNgE5nmlLG/Y0lBoExM/s=; b=Ov69T/HhFYdbcpwnKOFWU6rr8TPy2i52gL/MISj8YpWD4wzMwuX11lTXHeb5jU1wc/gTcL O5DEKONPEq/8qYvQ/gkmKFEJbxShnFKl7exk/ioIr9nd8Hgc9fTFksmqTlO3YNLejdcw1x iAnSMfrE8YB5ewxqlM6gyEZ+w1TJ6sGJYtew1DNkdcCLRLEY90ra/ywe9nlilXwOy1+hiY ERSXyaB2qi/TnHxwwCDKYKJspI1A+Ae1eCtV5LAC6AUO+Zh1euMjd2HKR0PGejwKZxdbnH PQR/mb+2a9NgzrfzATTznsv716YnEwgWYc3CUq5Z/xXira5lieb0B/dqzyMTxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gFQsh5q3gz1bl for ; Tue, 12 May 2026 19:00:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19662 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 12 May 2026 19:00:51 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Lianwei Wang From: Colin Percival Subject: git: a7bc1c0c353f - releng/15.1 - fsck_msdosfs: fix FAT header correction not persisting in cache mode List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.1 X-Git-Reftype: branch X-Git-Commit: a7bc1c0c353fc426ecfc98d42c807c74250c137d Auto-Submitted: auto-generated Date: Tue, 12 May 2026 19:00:51 +0000 Message-Id: <6a0378e3.19662.b76267f@gitrepo.freebsd.org> The branch releng/15.1 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=a7bc1c0c353fc426ecfc98d42c807c74250c137d commit a7bc1c0c353fc426ecfc98d42c807c74250c137d Author: Lianwei Wang AuthorDate: 2026-05-09 04:56:12 +0000 Commit: Colin Percival CommitDate: 2026-05-12 19:00:33 +0000 fsck_msdosfs: fix FAT header correction not persisting in cache mode When fsck_msdosfs runs with FAT32 cache mode (used for large filesystems that cannot be mmap'd), a detected FAT header correction was written into the in-memory buffer but the corresponding cache entry (fat32_cache_allentries[0]) was never marked dirty. As a result, fat_flush_fat32_cache_entry() skipped it, the corrected bytes were never written to disk, and copyfat() propagated the uncorrected on-disk data to all backup FAT copies. Every subsequent fsck run would repeat the same "FAT starts with odd byte sequence / FIXED" cycle indefinitely. Fix by marking fat32_cache_allentries[0].dirty = true after applying the in-memory correction, ensuring the chunk is flushed before copyfat() runs. Approved by: re (cperciva) Obtained from: https://android-review.googlesource.com/c/platform/external/fsck_msdos/+/4047981 (cherry picked from commit 10e342c1ec78af5a0b97739c806b16a632118fa5) (cherry picked from commit ae32d61a2e3e47bed54d861893d8e2da90fb7c76) --- sbin/fsck_msdosfs/fat.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c index 567bfcd428cb..5ead0b1bf783 100644 --- a/sbin/fsck_msdosfs/fat.c +++ b/sbin/fsck_msdosfs/fat.c @@ -927,6 +927,17 @@ readfat(int fs, struct bootblock *boot, struct fat_descriptor **fp) default: break; } + /* + * In cache mode the header lives in + * fat32_cache_allentries[0]. Mark it + * dirty so it is flushed to disk (either + * on eviction or in writefat()) before + * copyfat() copies the primary FAT to + * backup copies. + */ + if (fat->use_cache) + fat->fat32_cache_allentries[0].dirty = + true; } } }