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)
Fri, Dec 13, 5:59 PM
Unknown Object (File)
Thu, Dec 12, 6:04 PM
Unknown Object (File)
Wed, Dec 11, 11:28 AM
Unknown Object (File)
Nov 21 2024, 10:45 AM
Unknown Object (File)
Oct 27 2024, 12:50 PM
Unknown Object (File)
Oct 24 2024, 11:15 AM
Unknown Object (File)
Oct 20 2024, 2:09 AM
Unknown Object (File)
Oct 16 2024, 5:06 AM
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.