Page MenuHomeFreeBSD

Fix a bug with dirty file system handling.
ClosedPublic

Authored by delphij on Apr 26 2020, 8:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 11 2024, 7:46 PM
Unknown Object (File)
Mar 11 2024, 7:36 PM
Unknown Object (File)
Mar 11 2024, 7:36 PM
Unknown Object (File)
Mar 11 2024, 7:36 PM
Unknown Object (File)
Mar 8 2024, 3:22 AM
Unknown Object (File)
Feb 24 2024, 1:22 AM
Unknown Object (File)
Feb 11 2024, 9:27 AM
Unknown Object (File)
Jan 6 2024, 7:05 PM
Subscribers

Details

Summary

r356313 broke handling of dirty file system because we have restricted
the correction of "odd" byte sequences to checkfat(), and as a result
the dirty bit is never cleared. The old fsck_msdosfs code would write
FAT twice to fix the dirty bit, which is also not ideal.

Fix this by introducing a new rountine, cleardirty() which will perform
the set of clean bit only, and use it in checkfilesys() if we thought
the file system was dirty.

Test Plan

patch FAT16 and FAT32 filesystems with clean bit cleared
(modify byte 3 of FAT16 by or'ing 0x70, and modify byte 7 of FAT32 by
or'ing 0x07) and verify that fsck_msdosfs would correctly correct that
byte with and without -p if user answered yes, and don't correct
without -p if user answered no.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

delphij created this revision.
cem added a subscriber: cem.
cem added inline comments.
sbin/fsck_msdosfs/fat.c
664 ↗(On Diff #71020)

s/space/memory/ maybe

668–669 ↗(On Diff #71020)

Could just use len in place of boot->bpbBytesPerSec. Also for pwrite().

This revision is now accepted and ready to land.Apr 27 2020, 1:08 AM

Address reviewer comments.

This revision now requires review to proceed.Apr 27 2020, 1:29 AM

Please take another look, thanks!

This revision is now accepted and ready to land.Apr 27 2020, 1:50 AM
This revision was automatically updated to reflect the committed changes.