Date: Sat, 09 May 2026 04:57:27 +0000 From: Xin LI <delphij@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Lianwei Wang <lianwei.wang@gm.com> Subject: git: 10e342c1ec78 - main - fsck_msdosfs: fix FAT header correction not persisting in cache mode Message-ID: <69febeb7.3749a.5499531@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=10e342c1ec78af5a0b97739c806b16a632118fa5 commit 10e342c1ec78af5a0b97739c806b16a632118fa5 Author: Lianwei Wang <lianwei.wang@gm.com> AuthorDate: 2026-05-09 04:56:12 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2026-05-09 04:56:12 +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. Obtained from: https://android-review.googlesource.com/c/platform/external/fsck_msdos/+/4047981 MFC after: 3 days --- 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; } } }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69febeb7.3749a.5499531>
