path: root/sbin/fsck_ffs
Commit message (Collapse)AuthorAgeFilesLines
* Rename pass4check() to freeblock() and move from pass4.c to inode.c.Kirk McKusick2020-12-185-47/+41
| | | | | | | | | | | | The new name more accurately describes what it does and the file move puts it with other similar functions. Done in preparation for future cleanups. No functional differences intended. Sponsored by: Netflix Historic Footnote: my last FreeBSD svn commit Notes: svn path=/head/; revision=368773
* Use proper type (ino_t) for inode numbers to avoid improper sign extentionKirk McKusick2020-10-251-6/+7
| | | | | | | | | | | | | | | | in the Pass 5 checks. The manifestation was fsck_ffs exiting with this error: ** Phase 5 - Check Cyl groups fsck_ffs: inoinfo: inumber 18446744071562087424 out of range The error only manifests itself for filesystems bigger than about 100Tb. Reported by: Nikita Grechikhin <ngrechikhin at yandex.ru> MFC after: 2 weeks Sponsored by: Netflix Notes: svn path=/head/; revision=367045
* Various new check-hash checks have been added to the UFS filesystemKirk McKusick2020-10-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | over various major releases. Superblock check hashes were added for the 12 release and cylinder-group and inode check hashes will appear in the 13 release. When a disk with a UFS filesystem is writably mounted, the kernel clears the feature flags for anything that it does not support. For example, if a UFS disk from a 12-stable kernel is mounted on an 11-stable system, the 11-stable kernel will clear the flag in the filesystem superblock that indicates that superblock check-hashs are being maintained. Thus if the disk is later moved back to a 12-stable system, the 12-stable system will know to ignore its incorrect check-hash. If the only filesystem modification done on the earlier kernel is to run a utility such as growfs(8) that modifies the superblock but neither updates the check-hash nor clears the feature flag indicating that it does not support the check-hash, the disk will fail to mount if it is moved back to its original newer kernel. This patch moves the code that clears the filesystem feature flags from the mount code (ffs_mountfs()) to the code that reads the superblock (ffs_sbget()). As ffs_sbget() is used by the kernel mount code and is imported into libufs(3), all the filesystem utilities will now also clear these flags when they make modifications to the filesystem. As suggested by John Baldwin, fsck_ffs(8) has been changed to accept and repair bad superblock check-hashes rather than refusing to run. This change allows fsck to recover filesystems that have been impacted by utilities older than those created after this change and is a sensible thing to do in any event. Reported by: John Baldwin (jhb@) MFC after: 2 weeks Sponsored by: Netflix Notes: svn path=/head/; revision=367034
* Update the libufs cgget() and cgput() interfaces to have a similarKirk McKusick2020-09-193-4/+7
| | | | | | | | | | | | | | API to the sbget() and sbput() interfaces. Specifically they take a file descriptor pointer rather than the struct uufsd *disk pointer used by the libufs cgread() and cgwrite() interfaces. Update fsck_ffs to use these revised interfaces. No functional changes intended. Sponsored by: Netflix Notes: svn path=/head/; revision=365919
* Move all of the error prints in readsb() from stderr to stdout.Chuck Silvers2020-09-012-4/+4
| | | | | | | | | | | The only output from fsck that should go to stderr is the usage message. if setup() fails then exit with EEXIT rather than 0. Reviewed by: mckusick Sponsored by: Netflix Notes: svn path=/head/; revision=365056
* Use the sbput() function to write alternate superblocks so thatKirk McKusick2020-08-151-4/+3
| | | | | | | | | | they get a checkhash. PR: 246983 Sponsored by: Netflix Notes: svn path=/head/; revision=364262
* The libufs library needs to track and free the new fs_si structureKirk McKusick2020-06-231-1/+1
| | | | | | | | | | in addition to the fs_csp structure that it references. PR: 247425 Sponsored by: Netflix Notes: svn path=/head/; revision=362559
* Inode check-hash errors were being reported after system crashes.Kirk McKusick2020-04-101-0/+2
| | | | | | | | | | | | | | Trace the cause down to journalled soft updates recovery code in fsck failing to recompute the check-hash after updating an inode. As inode check-hash was first introduced to UFS in FreeBSD 13, there is no need to MFC this commit. Reported by: Chuck Silvers Sponsored by: Netflix Notes: svn path=/head/; revision=359790
* Add an inode check-hash verification when running the journalledKirk McKusick2020-04-101-2/+32
| | | | | | | | | | | | | soft update recovery code with the debugging (-d) option. As inode check-hash was first introduced to UFS in FreeBSD 13, there is no need to MFC this commit. Reported by: Chuck Silvers Sponsored by: Netflix Notes: svn path=/head/; revision=359789
* fsck_ffs/fsdb: fix -fno-common buildKyle Evans2020-03-294-5/+10
| | | | | | | | | | | | | | This one is also a small list: - 3x duplicate definition (ufs2_zino, returntosingle, nflag) - 5x 'needs extern', 3/5 of which are referenced in fsdb -fno-common will become the default in GCC10/LLVM11. MFC after: 1 week Notes: svn path=/head/; revision=359427
* When running fsck_ffs manually, do not ask:Kirk McKusick2019-12-242-7/+7
| | | | | | | | | | | | | | USE JOURNAL? [yn] when the journal timestamp does not match the filesystem mount time as we are just going to print an error and fall through to a full fsck. Instead, just run a full fsck. Requested by: Bjoern A. Zeeb (bz) MFC after: 7 days Notes: svn path=/head/; revision=356063
* Remove unused includes.Xin LI2019-12-221-4/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=356000
* fsck_ffs: fix some memory leaks found by Coverity.Eric van Gyzen2019-12-101-3/+12
| | | | | | | | | | Reported by: Coverity CID: 1380549 1380550 1380551 MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=355593
* Replace an uninitialized variable with the correct element from theKirk McKusick2019-10-221-1/+1
| | | | | | | | | | | superblock when doing recovery with journalled soft updates. Reported by: Chuck Silvers MFC after: 3 days Sponsored by: Netflix Notes: svn path=/head/; revision=353903
* Correct the location of the first backup superblock in fsck_ffs.8.Kirk McKusick2019-08-071-1/+1
| | | | | | | | | | | Make a note in the newfs.8 manual page to update the first backup superblock location when changing the default fragment size for the filesystem. Reported by: O. Hartmann Notes: svn path=/head/; revision=350682
* Treat any inode with bad content as unknown (i.e., ask if it shouldKirk McKusick2019-07-201-1/+1
| | | | | | | | | be cleared). Sponsored by: Netflix Notes: svn path=/head/; revision=350187
* When running with journaled soft updates, some updated inodes were notKirk McKusick2019-07-201-0/+11
| | | | | | | | | | | having their check hashes recomputed which resulted in spurious inode check-hash errors when the system came back up after a crash. Reported by: Alan Somers Sponsored by: Netflix Notes: svn path=/head/; revision=350186
* This revision began as a simple change to eliminate an uninitialized warningKirk McKusick2019-05-211-100/+105
| | | | | | | | | | | | | | | | found by Coverity. However, upon closer inspection the implementation of fsck_ffs's fsck_readdir() and dircheck() functions is both nearly impossible to follow and fails to check / fix directories in several cases. So, this revision is an entire rewrite of these two functions to clarify what they are doing and also to get something that works properly. Referred by: cem Reviewed by: kib, David G Lawrence MFC after: 3 days CID 1401317: namlen may be used uninitialized Notes: svn path=/head/; revision=348074
* This update eliminates a kernel stack disclosure bug in UFS/FFSKirk McKusick2019-05-035-20/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | directory entries that is caused by uninitialized directory entry padding written to the disk. It can be viewed by any user with read access to that directory. Up to 3 bytes of kernel stack are disclosed per file entry, depending on the the amount of padding the kernel needs to pad out the entry to a 32 bit boundry. The offset in the kernel stack that is disclosed is a function of the filename size. Furthermore, if the user can create files in a directory, this 3 byte window can be expanded 3 bytes at a time to a 254 byte window with 75% of the data in that window exposed. The additional exposure is done by removing the entry, creating a new entry with a 4-byte longer name, extracting 3 more bytes by reading the directory, and repeating until a 252 byte name is created. This exploit works in part because the area of the kernel stack that is being disclosed is in an area that typically doesn't change that often (perhaps a few times a second on a lightly loaded system), and these file creates and unlinks themselves don't overwrite the area of kernel stack being disclosed. It appears that this bug originated with the creation of the Fast File System in 4.1b-BSD (Circa 1982, more than 36 years ago!), and is likely present in every Unix or Unix-like system that uses UFS/FFS. Amazingly, nobody noticed until now. This update also adds the -z flag to fsck_ffs to have it scrub the leaked information in the name padding of existing directories. It only needs to be run once on each UFS/FFS filesystem after a patched kernel is installed and running. Submitted by: David G. Lawrence <dg@dglawrence.com> Reviewed by: kib MFC after: 1 week Notes: svn path=/head/; revision=347066
* Followup to -r344552 in which fsck_ffs checks for a size past theKirk McKusick2019-04-133-12/+17
| | | | | | | | | | | | | | | | | 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. This update corrects an error where fsck_ffs miscalculated the last logical block of the file when the file contained a large hole. Reported by: Jamie Landeg-Jones Tested by: Peter Holm MFC after: 2 weeks Sponsored by: Netflix Notes: svn path=/head/; revision=346185
* Properly calculate the last used logical block of a file when checkingKirk McKusick2019-03-022-3/+3
| | | | | | | | | | | | inodes that reference directories. While here tighten the check for comparing the last logical block with the end of the file. Reported by: Peter Holm Tested by: Peter Holm Sponsored by: Netflix Notes: svn path=/head/; revision=344732
* After a crash, a file that extends into indirect blocks may end upKirk McKusick2019-02-254-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=344552
* Ensure that inode updates are properly flushed out during the firstKirk McKusick2019-02-191-0/+6
| | | | | | | | | | | | pass of fsck_ffs. Some changes, such as check-hash corrections were being lost. Reported by: Michael Tuexen (tuexen@) Tested by: Michael Tuexen (tuexen@) MFC after: 3 days Notes: svn path=/head/; revision=344302
* Fsck would find, report, and offer to fix inode check-hash failures.Kirk McKusick2018-12-151-0/+2
| | | | | | | | | | | | | | | | | | | | | If requested to fix the inode check-hash it would confirm having done it, but then fail to make the fix. The same code is used in fsdb which, unlike fsck, would actually fix the inode check-hash. The discrepancy occurred because fsck has two ways to fetch inodes. The inode by number function ginode() and the streaming inode function getnextinode() used during pass1. Fsdb uses the ginode() function which correctly does the fix, while fsck first encounters the bad inode check-hash in pass1 where it is using the getnextinode() function that failed to make the correction. This patch corrects the getnextinode() function so that fsck now correctly fixes inodes with incorrect inode check-hashs. Reported by: Gary Jennejohn <gljennjohn@gmail.com> Sponsored by: Netflix Notes: svn path=/head/; revision=342128
* Make fsck(8) use pread(2). This cuts the number of syscalls by half.Edward Tomasz Napierala2018-12-151-15/+4
| | | | | | | | | | Reviewed by: kib, mckusick MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17586 Notes: svn path=/head/; revision=342115
* Continuing efforts to provide hardening of FFS. This change adds aKirk McKusick2018-12-112-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | check hash to the filesystem inodes. Access attempts to files associated with an inode with an invalid check hash will fail with EINVAL (Invalid argument). Access is reestablished after an fsck is run to find and validate the inodes with invalid check-hashes. This check avoids a class of filesystem panics related to corrupted inodes. The hash is done using crc32c. Note this check-hash is for the inode itself and not any of its indirect blocks. Check-hash validation may be extended to also cover indirect block pointers, but that will be a separate (and more costly) feature. Check hashes are added only to UFS2 and not to UFS1 as UFS1 is primarily used in embedded systems with small memories and low-powered processors which need as light-weight a filesystem as possible. Reviewed by: kib Tested by: Peter Holm Sponsored by: Netflix Notes: svn path=/head/; revision=341836
* Normally when an attempt is made to mount a UFS/FFS filesystem whoseKirk McKusick2018-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | superblock has a check-hash error, an error message noting the superblock check-hash failure is printed and the mount fails. The administrator then runs fsck to repair the filesystem and when successful, the filesystem can once again be mounted. This approach fails if the filesystem in question is a root filesystem from which you are trying to boot. Here, the loader fails when trying to access the filesystem to get the kernel to boot. So it is necessary to allow the loader to ignore the superblock check-hash error and make a best effort to read the kernel. The filesystem may be suffiently corrupted that the read attempt fails, but there is no harm in trying since the loader makes no attempt to write to the filesystem. Once the kernel is loaded and starts to run, it attempts to mount its root filesystem. Once again, failure means that it breaks to its prompt to ask where to get its root filesystem. Unless you have an alternate root filesystem, you are stuck. Since the root filesystem is initially mounted read-only, it is safe to make an attempt to mount the root filesystem with the failed superblock check-hash. Thus, when asked to mount a root filesystem with a failed superblock check-hash, the kernel prints a warning message that the root filesystem superblock check-hash needs repair, but notes that it is ignoring the error and proceeding. It does mark the filesystem as needing an fsck which prevents it from being enabled for writing until fsck has been run on it. The net effect is that the reboot fails to single user, but at least at that point the administrator has the tools at hand to fix the problem. Reported by: Rick Macklem (rmacklem@) Discussed with: Warner Losh (imp@) Sponsored by: Netflix Notes: svn path=/head/; revision=341608
* Ensure that cylinder-group check-hashes are properly updated when firstKirk McKusick2018-12-056-16/+42
| | | | | | | | | | creating them and when correcting them when they are found to be corrupted. Reported by: Don Lewis (truckman@) Sponsored by: Netflix Notes: svn path=/head/; revision=341510
* Properly recover from superblock check-hash failures. Specifically,Kirk McKusick2018-11-251-5/+3
| | | | | | | | | | | | | report the check-hash failure and offer to search for and use alternate superblocks. Prior to this fix fsck_ffs would simply report the check-hash failure and exit. Reported by: Julian H. Stacey <jhs@berklix.com> Tested by: Peter Holm Sponsored by: Netflix Notes: svn path=/head/; revision=340925
* In preparation for adding inode check-hashes, clean up andKirk McKusick2018-11-136-44/+51
| | | | | | | | | | | | | | | | | | | document the libufs interface for fetching and storing inodes. The undocumented getino / putino interface has been replaced with a new getinode / putinode interface. Convert the utilities that had been using the undocumented interface to use the new documented interface. No functional change (as for now the libufs library does not do inode check-hashes). Reviewed by: kib Tested by: Peter Holm Sponsored by: Netflix Notes: svn path=/head/; revision=340411
* In preparation for adding inode check-hashes, change the fsck_ffsKirk McKusick2018-10-315-23/+23
| | | | | | | | | | inodirty() function to have a pointer to the inode being dirtied. No functional change (as for now the parameter is ununsed). Sponsored by: Netflix Notes: svn path=/head/; revision=339941
* Continuing efforts to provide hardening of FFS, this change adds aKirk McKusick2018-10-231-3/+5
| | | | | | | | | | | | | | | | | | check hash to the superblock. If a check hash fails when an attempt is made to mount a filesystem, the mount fails with EINVAL (Invalid argument). This avoids a class of filesystem panics related to corrupted superblocks. The hash is done using crc32c. Check hases are added only to UFS2 and not to UFS1 as UFS1 is primarily used in embedded systems with small memories and low-powered processors which need as light-weight a filesystem as possible. Reviewed by: kib Tested by: Peter Holm Sponsored by: Netflix Notes: svn path=/head/; revision=339671
* Add missing newline in pwarn message.Kirk McKusick2018-10-021-1/+1
| | | | | | | | Reported by: Mark Millard <marklmi@yahoo.com> Approved by: re (kib) Notes: svn path=/head/; revision=339082
* Make timespecadd(3) and friends publicAlan Somers2018-07-301-27/+6
| | | | | | | | | | | | | | | | | | | | | | The timespecadd(3) family of macros were imported from NetBSD back in r35029. However, they were initially guarded by #ifdef _KERNEL. In the meantime, we have grown at least 28 syscalls that use timespecs in some way, leading many programs both inside and outside of the base system to redefine those macros. It's better just to make the definitions public. Our kernel currently defines two-argument versions of timespecadd and timespecsub. NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define three-argument versions. Solaris also defines a three-argument version, but only in its kernel. This revision changes our definition to match the common three-argument version. Bump _FreeBSD_version due to the breaking KPI change. Discussed with: cem, jilles, ian, bde Differential Revision: https://reviews.freebsd.org/D14725 Notes: svn path=/head/; revision=336914
* Revert r313780 (UFS_ prefix)Ed Maste2018-03-176-61/+59
| | | | Notes: svn path=/head/; revision=331095
* Prefix UFS symbols with UFS_ to reduce namespace pollutionEd Maste2018-03-176-59/+61
| | | | | | | | | | | | | Followup to r313780. Also prefix ext2's and nandfs's versions with EXT2_ and NANDFS_. Reported by: kib Reviewed by: kib, mckusick Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9623 Notes: svn path=/head/; revision=331083
* Fix a read past the end of a buffer in fsck.Kirk McKusick2018-02-211-1/+3
| | | | | | | | | | | | | | | | | | To minimize the time spent scanning all of the directories in pass 2 (Check Pathnames), fsck uses a search order based on the location of their first block. Zero length directories have no first block, so the array being used to hold the block numbers of directory inodes was of zero length. Thus a lookup was done past the end of the array getting at best a random value and at worst a segment fault. For zero length directories, this change allocates a one element block array and initializes it to zero. The effect is that all zero length directories are handled first in pass 2. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D14163 Notes: svn path=/head/; revision=329749
* Include files missed in 329051.Kirk McKusick2018-02-083-1/+43
| | | | Notes: svn path=/head/; revision=329052
* The goal of this change is to prevent accidental foot shooting byKirk McKusick2018-02-081-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | folks running filesystems created on check-hash enabled kernels (which I will call "new") on a non-check-hash enabled kernels (which I will call "old). The idea here is to detect when a filesystem is run on an old kernel and flag the filesystem so that when it gets moved back to a new kernel, it will not start getting a slew of check-hash errors. Back when the UFS version 2 filesystem was created, it added a file flag FS_INDEXDIRS that was to be set on any filesystem that kept some sort of on-disk indexing for directories. The idea was precisely to solve the issue we have today. Specifically that a newer kernel that supported indexing would be able to tell that the filesystem had been run on an older non-indexing kernel and that the indexes should not be used until they had been rebuilt. Since we have never implemented on-disk directory indicies, the FS_INDEXDIRS flag is cleared every time any UFS version 2 filesystem ever created is mounted for writing. This commit repurposes the FS_INDEXDIRS flag as the FS_METACKHASH flag. Thus, the FS_METACKHASH is definitively known to have always been cleared. The FS_INDEXDIRS flag has been moved to a new block of flags that will always be cleared starting with this commit (until they get used to implement some future feature which needs to detect that the filesystem was mounted on a kernel that predates the new feature). If a filesystem with check-hashes enabled is mounted on an old kernel the FS_METACKHASH flag is cleared. When that filesystem is mounted on a new kernel it will see that the FS_METACKHASH has been cleared and clears all of the fs_metackhash flags. To get them re-enabled the user must run fsck (in interactive mode without the -y flag) which will ask for each supported check hash whether it should be rebuilt and enabled. When fsck is run in its default preen mode, it will just ignore the check hashes so they will remain disabled. The kernel has always disabled any check hash functions that it does not support, so as more types of check hashes are added, we will get a non-surprising result. Specifically if filesystems get moved to kernels supporting fewer of the check hashes, those that are not supported will be disabled. If the filesystem is moved back to a kernel with more of the check-hashes available and fsck is run interactively to rebuild them, then their checking will resume. Otherwise just the smaller subset will be checked. A side effect of this commit is that filesystems running with cylinder-group check hashes will stop having them checked until fsck is run to re-enable them (since none of them currently have the FS_METACKHASH flag set). So, if you want check hashes enabled on your filesystems after booting a kernel with these changes, you need to run fsck to enable them. Any newly created filesystems will have check hashes enabled. If in doubt as to whether you have check hashes emabled, run dumpfs and look at the list of enabled flags at the end of the superblock details. Notes: svn path=/head/; revision=329051
* Use sbput(3) rather than sbwrite(3) to ensure that the updated copy ofKirk McKusick2018-02-021-2/+2
| | | | | | | | | the superblock gets written. Reported by: Mark Johnston <markj@FreeBSD.org> Notes: svn path=/head/; revision=328763
* Refactoring of reading and writing of the UFS/FFS superblock.Kirk McKusick2018-01-264-58/+31
| | | | | | | | | | | | | | | Specifically reading is done if ffs_sbget() and writing is done in ffs_sbput(). These functions are exported to libufs via the sbget() and sbput() functions which then used in the various filesystem utilities. This work is in preparation for adding subperblock check hashes. No functional change intended. Reviewed by: kib Notes: svn path=/head/; revision=328426
* Fix architectures where pointer and u_int have different sizesLi-Wen Hsu2018-01-251-2/+2
| | | | | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D14049 Notes: svn path=/head/; revision=328393
* More throughly integrate libufs into fsck_ffs by using its cgput()Kirk McKusick2018-01-245-85/+73
| | | | | | | | | | routine to write out the cylinder groups rather than recreating the calculation of the cylinder-group check hash in fsck_ffs. No functional change intended. Notes: svn path=/head/; revision=328383
* Correct fsck journal-recovery code to update a cylinder-groupKirk McKusick2018-01-172-9/+5
| | | | | | | | | | | | | | | | | | | check-hash after making changes to the cylinder group. The problem was that the journal-recovery code was calling the libufs bwrite() function instead of the cgput() function. The cgput() function updates the cylinder-group check-hash before writing the cylinder group. This change required the additions of the cgget() and cgput() functions to the libufs API to avoid a gratuitous bcopy of every cylinder group to be read or written. These new functions have been added to the libufs manual pages. This was the first opportunity that I have had to use and document the use of the EDOOFUS error code. Reviewed by: kib Reported by: emaste and others Notes: svn path=/head/; revision=328092
* Rename cgget => cglookup to clear name space for new libufs function cgget.Kirk McKusick2018-01-175-6/+6
| | | | | | | No functional change. Notes: svn path=/head/; revision=328075
* Exit fsck_ffs with non-zero status when file system is not repaired.David Bright2018-01-153-6/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the fsck_ffs program cannot fully repair a file system, it will output the message PLEASE RERUN FSCK. However, it does not exit with a non-zero status in this case (contradicting the man page claim that it "exits with 0 on success, and >0 if an error occurs." The fsck rc-script (when running "fsck -y") tests the status from fsck (which passes along the exit status from fsck_ffs) and issues a "stop_boot" if the status fails. However, this is not effective since fsck_ffs can return zero even on (some) errors. Effectively, it is left to a later step in the boot process when the file systems are mounted to detect the still-unclean file system and stop the boot. This change modifies fsck_ffs so that when it cannot fully repair the file system and issues the PLEASE RERUN FSCK message it also exits with a non-zero status. While here, the fsck_ffs man page has also been updated to document the failing exit status codes used by fsck_ffs. Previously, only exit status 7 was documented. Some of these exit statuses are tested for in the fsck rc-script, so they are clearly depended upon and deserve documentation. Reviewed by: mckusick, vangyzen, jilles (manpages) MFC after: 1 week Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D13862 Notes: svn path=/head/; revision=328013
* Report CG checksum mismatches. These errors are non-fatal. TheWarner Losh2018-01-141-1/+12
| | | | | | | | | | | | previous behavior is preserved (the CG checksum is fixed). We're just noisy about it now. Reviewed by: kirk@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13884 Notes: svn path=/head/; revision=327970
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-272-1/+5
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2015-14/+44
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Rename P_OSREL_CK_CLYGRP to P_OSREL_CK_CYLGRPScott Long2017-11-171-1/+1
| | | | Notes: svn path=/head/; revision=325934