HomeFreeBSD

Improve handling of missing '.' and '..' in UFS directories.

Description

Improve handling of missing '.' and '..' in UFS directories.

The UFS filesystem expects to find '.' and '..' as the first two entries
in a directory. The kernel's UFS name cache can become quite confused
when these two entries are not present as the first two entries.

Prior to this change, when the fsck_ffs(8) utility detected that
'.' and/or '..' were missing, it would report them, but only offered
to replace them if the space at the beginning of the directory was
available. Otherwise it was left to the system administrator to
move the offending file(s) out of the way and then rerun fsck_ffs(8)
to create the '.' and '..' entries.

With this change, fsck_ffs(8) will always be able to create the '.'
and/or '..' entries. It moves any files in the way elsewhere in the
directory block. If there is no room in the directory block to which
to move them, they are placed in the lost+found directory.

Reported by: Peter Holm
Sponsored by: The FreeBSD Foundation

Details

Provenance
mckusickAuthored on Aug 17 2022, 9:19 PM
Parents
rG4f9606c9a615: When reading backup UFS superblocks, report reason if they cannot be used.
Branches
Unknown
Tags
Unknown