#
75e3597a |
| 22-Sep-2017 |
Kirk McKusick <mckusick@FreeBSD.org> |
Continuing efforts to provide hardening of FFS, this change adds a check hash to cylinder groups. If a check hash fails when a cylinder group is read, no further allocations are attempted in that cyl
Continuing efforts to provide hardening of FFS, this change adds a check hash to cylinder groups. If a check hash fails when a cylinder group is read, no further allocations are attempted in that cylinder group until it has been fixed by fsck. This avoids a class of filesystem panics related to corrupted cylinder group maps. 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.
Specifics of the changes:
sys/sys/buf.h: Add BX_FSPRIV to reserve a set of eight b_xflags that may be used by individual filesystems for their own purpose. Their specific definitions are found in the header files for each filesystem that uses them. Also add fields to struct buf as noted below.
sys/kern/vfs_bio.c: It is only necessary to compute a check hash for a cylinder group when it is actually read from disk. When calling bread, you do not know whether the buffer was found in the cache or read. So a new flag (GB_CKHASH) and a pointer to a function to perform the hash has been added to breadn_flags to say that the function should be called to calculate a hash if the data has been read. The check hash is placed in b_ckhash and the B_CKHASH flag is set to indicate that a read was done and a check hash calculated. Though a rather elaborate mechanism, it should also work for check hashing other metadata in the future. A kernel internal API change was to change breada into a static fucntion and add flags and a function pointer to a check-hash function.
sys/ufs/ffs/fs.h: Add flags for types of check hashes; stored in a new word in the superblock. Define corresponding BX_ flags for the different types of check hashes. Add a check hash word in the cylinder group.
sys/ufs/ffs/ffs_alloc.c: In ffs_getcg do the dance with breadn_flags to get a check hash and if one is provided, check it.
sys/ufs/ffs/ffs_vfsops.c: Copy across the BX_FFSTYPES flags in background writes. Update the check hash when writing out buffers that need them.
sys/ufs/ffs/ffs_snapshot.c: Recompute check hash when updating snapshot cylinder groups.
sys/libkern/crc32.c: lib/libufs/Makefile: lib/libufs/libufs.h: lib/libufs/cgroup.c: Include libkern/crc32.c in libufs and use it to compute check hashes when updating cylinder groups.
Four utilities are affected:
sbin/newfs/mkfs.c: Add the check hashes when building the cylinder groups.
sbin/fsck_ffs/fsck.h: sbin/fsck_ffs/fsutil.c: Verify and update check hashes when checking and writing cylinder groups.
sbin/fsck_ffs/pass5.c: Offer to add check hashes to existing filesystems. Precompute check hashes when rebuilding cylinder group (although this will be done when it is written in fsutil.c it is necessary to do it early before comparing with the old cylinder group)
sbin/dumpfs/dumpfs.c Print out the new check hash flag(s)
sbin/fsdb/Makefile: Needs to add libufs now used by pass5.c imported from fsck_ffs.
Reviewed by: kib Tested by: Peter Holm (pho)
show more ...
|
Revision tags: release/11.1.0 |
|
#
348238db |
| 01-Mar-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r314420 through r314481.
|
#
fbbd9655 |
| 01-Mar-2017 |
Warner Losh <imp@FreeBSD.org> |
Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is
Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point.
Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
show more ...
|
#
a3906ca5 |
| 17-Feb-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r313644 through r313895.
|
#
1dc349ab |
| 15-Feb-2017 |
Ed Maste <emaste@FreeBSD.org> |
prefix UFS symbols with UFS_ to reduce namespace pollution
Specifically: ROOTINO -> UFS_ROOTINO WINO -> UFS_WINO NXADDR -> UFS_NXADDR NDADDR -> UFS_NDADDR NIADDR -> UFS_NIADDR MAXSYMLINK
prefix UFS symbols with UFS_ to reduce namespace pollution
Specifically: ROOTINO -> UFS_ROOTINO WINO -> UFS_WINO NXADDR -> UFS_NXADDR NDADDR -> UFS_NDADDR NIADDR -> UFS_NIADDR MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)
Also prefix ext2's and nandfs's NDADDR and NIADDR with EXT2_ and NANDFS_
Reviewed by: kib, mckusick Obtained from: NetBSD MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9536
show more ...
|
Revision tags: release/11.0.1, release/11.0.0 |
|
#
9c831bbd |
| 13-Apr-2016 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: The FreeBSD Foundation
|
#
7d5e6562 |
| 13-Apr-2016 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
fsck_ffs for pointers replace 0 with NULL.
Found with devel/coccinelle.
Reviewed by: mckusick
|
Revision tags: release/10.3.0, release/10.2.0, release/10.1.0, release/9.3.0, release/10.0.0, release/9.2.0 |
|
#
d1d01586 |
| 05-Sep-2013 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Merge from head
|
#
40f65a4d |
| 07-Aug-2013 |
Peter Grehan <grehan@FreeBSD.org> |
IFC @ r254014
|
#
552311f4 |
| 17-Jul-2013 |
Xin LI <delphij@FreeBSD.org> |
IFC @253398
|
#
cfe30d02 |
| 19-Jun-2013 |
Gleb Smirnoff <glebius@FreeBSD.org> |
Merge fresh head.
|
Revision tags: release/8.4.0 |
|
#
5c6fe3a9 |
| 29-Apr-2013 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
Style nit.
|
#
2b5373de |
| 29-Apr-2013 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
Add a -Z option which zeroes unused blocks. It can be combined with -E, in which case unused blocks are first zeroed and then erased.
Reviewed by: mckusick MFC after: 3 weeks
|
#
69e6d7b7 |
| 12-Apr-2013 |
Simon J. Gerraty <sjg@FreeBSD.org> |
sync from head
|
#
81fbded2 |
| 23-Mar-2013 |
Kirk McKusick <mckusick@FreeBSD.org> |
Revert 248634 and 248643 (e.g., restoring 248625 and 248639).
Build verified by: Glen Barber (gjb@)
|
#
115f80b8 |
| 23-Mar-2013 |
Sean Bruno <sbruno@FreeBSD.org> |
Revert svn r248625
Clang errors around printf could be trivially fixed, but the breakage in sbin/fsdb were to significant for this type of change.
Submitter of this changeset has been notified and
Revert svn r248625
Clang errors around printf could be trivially fixed, but the breakage in sbin/fsdb were to significant for this type of change.
Submitter of this changeset has been notified and hopefully this can be restored soon.
show more ...
|
#
776816d3 |
| 22-Mar-2013 |
Kirk McKusick <mckusick@FreeBSD.org> |
Speed up fsck by caching the cylinder group maps in pass1 so that they do not need to be read again in pass5. As this nearly doubles the memory requirement for fsck, the cache is thrown away if other
Speed up fsck by caching the cylinder group maps in pass1 so that they do not need to be read again in pass5. As this nearly doubles the memory requirement for fsck, the cache is thrown away if other memory needs in fsck would otherwise fail. Thus, the memory footprint of fsck remains unchanged in memory constrained environments.
This work was inspired by a paper presented at Usenix's FAST '13: www.usenix.org/conference/fast13/ffsck-fast-file-system-checker
Details of this implementation appears in the April 2013 of ;login: www.usenix.org/publications/login/april-2013-volume-38-number-2. A copy of the April 2013 ;login: paper can also be downloaded from: www.mckusick.com/publications/faster_fsck.pdf.
Reviewed by: kib Tested by: Peter Holm MFC after: 4 weeks
show more ...
|
Revision tags: release/9.1.0, release/8.3.0_cvs, release/8.3.0, release/9.0.0 |
|
#
bd2228ab |
| 19-Jul-2011 |
Peter Grehan <grehan@FreeBSD.org> |
IFC @ r224187
|
#
935205e2 |
| 17-Jul-2011 |
Justin T. Gibbs <gibbs@FreeBSD.org> |
Integrate from Head into ZFSD feature branch as of revision r224141.
|
#
d2404f04 |
| 15-Jul-2011 |
Kirk McKusick <mckusick@FreeBSD.org> |
Break out the pass 5 inode and block map updating into a separate function so that the function can be used by the journaling soft updates recovery.
|
#
8d3dfc26 |
| 30-Apr-2011 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
Add an -E option to mirror newfs's. The idea is that if you have a system that was built before ffs grew support for TRIM, your filesystem will have plenty of free blocks that the flash chip doesn't
Add an -E option to mirror newfs's. The idea is that if you have a system that was built before ffs grew support for TRIM, your filesystem will have plenty of free blocks that the flash chip doesn't know are free, so it can't take advantage of them for wear leveling. Once you've upgraded your kernel, you enable TRIM on the filesystem (tunefs -t enable), then run fsck_ffs -E on it before mounting it.
I tested this patch by half-filling an mdconfig'ed filesystem image, running fsck_ffs -E on it, then verifying that the contents were not damaged by comparing them to a pristine copy using rsync's checksum functionality. There is no reliable way to test it on real hardware.
Many thanks to mckusick@, who provided the tricky parts of this patch and reviewed the final version.
Reviewed by: mckusick@ MFC after: 3 weeks
show more ...
|
Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0, release/8.1.0_cvs, release/8.1.0 |
|
#
a4bf5fb9 |
| 28-Apr-2010 |
Kirk McKusick <mckusick@FreeBSD.org> |
Update to current version of head.
|
#
113db2dd |
| 24-Apr-2010 |
Jeff Roberson <jeff@FreeBSD.org> |
- Merge soft-updates journaling from projects/suj/head into head. This brings in support for an optional intent log which eliminates the need for background fsck on unclean shutdown.
Sponsore
- Merge soft-updates journaling from projects/suj/head into head. This brings in support for an optional intent log which eliminates the need for background fsck on unclean shutdown.
Sponsored by: iXsystems, Yahoo!, and Juniper. With help from: McKusick and Peter Holm
show more ...
|
Revision tags: release/7.3.0_cvs, release/7.3.0, release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0, release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0 |
|
#
e6e1a3a8 |
| 13-Oct-2008 |
Konstantin Belousov <kib@FreeBSD.org> |
Background fsck applies twice some summary totals changes. The next background fsck on the same file system might then print negative numbers for reclaimed directories/files/fragments.
Address the i
Background fsck applies twice some summary totals changes. The next background fsck on the same file system might then print negative numbers for reclaimed directories/files/fragments.
Address the issue in a limited degree, by using old summary data for cg when bgfsck is performed.
Submitted by: tegge MFC after: 1 week
show more ...
|
#
717902b6 |
| 13-Oct-2008 |
Konstantin Belousov <kib@FreeBSD.org> |
check_maps() in /usr/src/sbin/fsck_ffs/pass5.c seems to be limited to file systems less than 1 TB, due to using 32-bits integers for file system block numbers. This also causes incorrect error report
check_maps() in /usr/src/sbin/fsck_ffs/pass5.c seems to be limited to file systems less than 1 TB, due to using 32-bits integers for file system block numbers. This also causes incorrect error reporting for foreground fsck.
Convert it to use ufs2_daddr_t for block numbers.
PR: kern/127951 Submitted by: tegge MFC after: 1 week
show more ...
|