fsck_ffs: fix background fsck in preen mode
Background checks are only allowed for mounted filesystems - don't try
to open the device for writing when performing a background check.
While here, remove a debugging printf that's commented out.
PR: 256746
Fixes: 5cc52631b3
Reviewed by: mckusick
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D30880
This commit is contained in:
parent
4488c8c34b
commit
0c5a59252c
@ -295,15 +295,14 @@ checkfilesys(char *filesys)
|
||||
*/
|
||||
if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0)
|
||||
exit(3); /* Cannot read superblock */
|
||||
if (nflag || (fswritefd = open(filesys, O_WRONLY)) < 0) {
|
||||
if (bkgrdflag == 0 &&
|
||||
(nflag || (fswritefd = open(filesys, O_WRONLY)) < 0)) {
|
||||
fswritefd = -1;
|
||||
if (preen)
|
||||
pfatal("NO WRITE ACCESS");
|
||||
printf(" (NO WRITE)");
|
||||
}
|
||||
if ((sblock.fs_flags & FS_GJOURNAL) != 0) {
|
||||
//printf("GJournaled file system detected on %s.\n",
|
||||
// filesys);
|
||||
if (sblock.fs_clean == 1) {
|
||||
pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
|
||||
exit(0);
|
||||
@ -317,11 +316,11 @@ checkfilesys(char *filesys)
|
||||
} else {
|
||||
pfatal(
|
||||
"UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n");
|
||||
}
|
||||
}
|
||||
close(fsreadfd);
|
||||
close(fswritefd);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we are to do a background check:
|
||||
* Get the mount point information of the file system
|
||||
|
Loading…
Reference in New Issue
Block a user