summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/main.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2010-06-22 00:26:07 +0000
committerdelphij <delphij@FreeBSD.org>2010-06-22 00:26:07 +0000
commit716b58576aa778a987f7d3d070fbb037b287ff0a (patch)
tree3cb8006015bedfb66fe3744a0f608b48814d7ac7 /sbin/fsck_ffs/main.c
parent3832173dc19324482f3166324370dccc455c2e12 (diff)
downloadFreeBSD-src-716b58576aa778a987f7d3d070fbb037b287ff0a.zip
FreeBSD-src-716b58576aa778a987f7d3d070fbb037b287ff0a.tar.gz
Improve fsck robustness for SU+J cases:
- Use err/errx only when the case is really fatal. For other cases, fall back to full fsck instead of quiting fsck. - Plug a memory leak. - Avoid divide by zero when printing summary. - Output "FILE SYSTEM IS MARKED CLEAN" when a successful journal recovering is done. - When -f is specified, do full fsck instead of journal recovery.
Diffstat (limited to 'sbin/fsck_ffs/main.c')
-rw-r--r--sbin/fsck_ffs/main.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index e9a9704..6855610 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -388,16 +388,18 @@ checkfilesys(char *filesys)
/*
* Determine if we can and should do journal recovery.
*/
- if ((sblock.fs_flags & (FS_SUJ | FS_NEEDSFSCK)) == FS_SUJ) {
- if (preen || reply("USE JOURNAL?")) {
- if (suj_check(filesys) == 0) {
- if (chkdoreload(mntp) == 0)
- exit(0);
- exit(4);
+ if ((sblock.fs_flags & FS_SUJ) == FS_SUJ) {
+ if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && skipclean) {
+ if (preen || reply("USE JOURNAL?")) {
+ if (suj_check(filesys) == 0) {
+ printf("\n***** FILE SYSTEM MARKED CLEAN *****\n");
+ if (chkdoreload(mntp) == 0)
+ exit(0);
+ exit(4);
+ }
}
- /* suj_check failed, fall through. */
+ printf("** Skipping journal, falling through to full fsck\n\n");
}
- printf("** Skipping journal, falling through to full fsck\n");
/*
* Write the superblock so we don't try to recover the
* journal on another pass.
OpenPOWER on IntegriCloud