freebsd-src/sbin/fsck_ffs
Kirk McKusick d3a36e4b74 Delete snapshot after opening it when running fsck_ffs(9) in background.
When fsck_ffs(8) runs in background, it creates a snapshot named
fsck_snapshot in the filesystem's .snap directory. The fsck_snapshot
file was removed when the background fsck finished. If the system
crashed or the fsck exited unexpectedly, the fsck_snapshot file
would remain. The snapshot would consume ever more space as the
filesystem changed over time until it was removed by a system
administrator or a future run of background fsck removed it to
create a new snapshot file.

This commit unlinks the .snap/fsck_snapshot file immediately after
opening it so that it will be reclaimed when fsck closes it at the
conclusion of its run. After a system crash, it will be removed as
part of the filesystem cleanup because of its zero reference count.
As only a few milliseconds pass between its creation and unlinking,
there is far less opportunity for it to be accidentally left behind.

PR:           106107
MFC-after:    1 week
2023-10-25 15:38:11 -07:00
..
dir.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
ea.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
fsck.h Delete snapshot after opening it when running fsck_ffs(9) in background. 2023-10-25 15:38:11 -07:00
fsck_ffs.8 Remove $FreeBSD$: one-line nroff pattern 2023-08-16 11:55:15 -06:00
fsutil.c Delete snapshot after opening it when running fsck_ffs(9) in background. 2023-10-25 15:38:11 -07:00
gjournal.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
globs.c Delete snapshot after opening it when running fsck_ffs(9) in background. 2023-10-25 15:38:11 -07:00
inode.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
main.c Delete snapshot after opening it when running fsck_ffs(9) in background. 2023-10-25 15:38:11 -07:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
pass1.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
pass1b.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
pass2.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
pass3.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
pass4.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
pass5.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
setup.c Delete snapshot after opening it when running fsck_ffs(9) in background. 2023-10-25 15:38:11 -07:00
suj.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
utilities.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00