HomeFreeBSD

fsck_msdosfs: truncate directory entry when the head pointer is invalid.

Description

fsck_msdosfs: truncate directory entry when the head pointer is invalid.

As far as we know, there is no FAT implementation that supported hard
links, and our msdosfs driver assumed one cluster chain is only
referenced by one directory entry and clears it out when the file is
deleted. On the other hand, the current code would proceed with
checkchain() when the directory entry's head cluster is a valid numbered
cluster without checking if it was a valid head node of a cluster chain.

So if the cluster do not being a chain (e.g. CLUST_FREE, CLUST_BAD),
or was already referenced by another directory entry, this would
trigger an assertion in check_chain() at a later time.

Fix this by giving the user an option to truncate the directory entry
when the head cluster is an invalid cluster, an visited head node,
or not a head node.

Reported by: NetApp (kevans@)
Reviewed by: kevans, emaste (no objection)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D32699

Details

Provenance
delphijAuthored on Nov 4 2021, 5:09 AM
Reviewer
kevans
Differential Revision
D32699: fsck_msdosfs: truncate directory entry when the head pointer is invalid.
Parents
rG15bd9fa3bea7: procfs_doprocfile(): simplify
Branches
Unknown
Tags
Unknown