freebsd-nq/sbin/fsdb
Kirk McKusick ac4b20a0a7 After a crash, a file that extends into indirect blocks may end up
shorter than its size resulting in a hole as its final block (which
is a violation of the invarients of the UFS filesystem).

Soft updates will always ensure that the file size is correct when
writing inodes to disk for files that contain only direct block
pointers. However soft updates does not roll back sizes for files
with indirect blocks that it has set to unallocated because their
contents have not yet been written to disk. Hence, the file can
appear to have a hole at its end because the block pointer has been
rolled back to zero when its inode was written to disk. Thus,
fsck_ffs calculates the last allocated block in the file. For files
that extend into indirect blocks, fsck_ffs checks for a size past
the last allocated block of the file and if that is found, shortens
the file to reference the last allocated block thus avoiding having
it reference a hole at its end.

Submitted by: Chuck Silvers <chs@netflix.com>
Tested by:    Chuck Silvers <chs@netflix.com>
MFC after:    1 week
Sponsored by: Netflix
2019-02-25 21:58:19 +00:00
..
fsdb.8
fsdb.c After a crash, a file that extends into indirect blocks may end up 2019-02-25 21:58:19 +00:00
fsdb.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
fsdbutil.c When using the fsdb `blocks' command, replace the long and ugly list of 2018-04-08 07:06:12 +00:00
Makefile When using the fsdb `blocks' command, replace the long and ugly list of 2018-04-08 07:06:12 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00