summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
Commit message (Collapse)AuthorAgeFilesLines
* MFC of 263062:mckusick2014-03-222-9/+13
| | | | | | | | | | | | | | | | | | | Avoid segment fault when attempting to clean up cylinder group buffer cache. PR: 187221 Submitted by: Petr Lampa <lampa@fit.vutbr.cz> Obtained from: Petr Lampa <lampa@fit.vutbr.cz> MFC after: 1 week MFC of 262488: Arguments for malloc and calloc should be size_t, not int. Use proper bounds check when trying to free cached memory. Spotted by: Xin Li Tested by: Dmitry Sivachenko MFC after: 2 weeks
* MFC r260068, r260069, r260076scottl2014-01-0211-108/+348
| | | | | | | | | | | | | | | | | | | | | | Add the -R option to allow fsck_ffs to restart itself when too many critical errors have been detected in a particular run. Clean up the global state variables so that a restart can happen correctly. Separate the global variables in fsck_ffs and fsdb to their own file. This fixes header sharing with fscd. Correctly initialize, static-ize, and remove global variables as needed in dir.c. This fixes a problem with lost+found directories that was causing a segfault. Correctly initialize, static-ize, and remove global variables as needed in suj.c. Initialize the suj globals before allocating the disk object, not after. Also ensure that 'preen' mode doesn't conflict with 'restart' mode Obtained from: Netflix
* MFC r256448, r257029;pfg2013-12-111-1/+1
| | | | | | | | | | | | | Make di_blocks unsigned in UFS1 as is the case already for UFS2. Most of the code between UFS1 and UFS2 is shared so this change is pretty safe. Not only this makes UFS1 and 2 consistent but it also matches what NetBSD and MacOS X have for some years now. UFS2: make di_extsize unsigned. di_extsize is the EA size and as such it should be unsigned. Adjust related types for consistency. Reviewed by: mckusick
* Fix the zeroing loop. I must have been drunk when I wrote this...des2013-08-201-6/+6
| | | | MFC after: 3 days
* Document the -S flag to fsck_ffsscottl2013-07-311-1/+6
| | | | Obtained from: Netflix
* Add a 'surrender' mode to fsck_ffs. With the -S flag, once hard read errorsscottl2013-07-303-2/+18
| | | | | | | | are encountered, the fsck will stop instead of wasting time chewing through possibly other errors. Obtained from: Netflix MFC after: 3 days
* Style nit.des2013-04-291-1/+2
|
* Add a -Z option which zeroes unused blocks. It can be combined with -E,des2013-04-295-7/+56
| | | | | | | in which case unused blocks are first zeroed and then erased. Reviewed by: mckusick MFC after: 3 weeks
* Note that output is in seconds, not msec.mckusick2013-03-241-2/+3
| | | | | | | | | KNF indentation. No functional change. No change to printf strings. No change to casting of printf arguments. Reported by: Bruce Evans
* Resolve clang compile errors on amd64/i386 for certain by casting.sbruno2013-03-241-4/+4
| | | | | | | compile tested with clang on i386, amd64 compile tested with gcc on i386, amd64, sparc64 Submitted by: delphij
* Minor formatting fix for printf() to fix clang builds.sbruno2013-03-241-2/+2
| | | | | Submitted by: db Reviewed by: gjb
* Revert 248634 and 248643 (e.g., restoring 248625 and 248639).mckusick2013-03-237-56/+154
| | | | Build verified by: Glen Barber (gjb@)
* Revert svn r248625sbruno2013-03-237-154/+56
| | | | | | | | 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.
* Speed up fsck by caching the cylinder group maps in pass1 somckusick2013-03-227-56/+154
| | | | | | | | | | | | | | | | | | | | 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
* Fix ARM build by assigning the computed time here tokientzle2013-02-251-2/+2
| | | | a variable of the right type for printf.
* When running with the -d option, instrument fsck_ffs to track the number,mckusick2013-02-247-37/+206
| | | | | | data type, and running time of its I/O operations. No functional changes.
* Update fsck_ffs buffer cache manager to use TAILQ macros.mckusick2013-02-152-31/+31
| | | | No functional changes.
* - blk_equals() is too strict. If the journal entry defines more fragsjeff2012-11-141-10/+8
| | | | | | | | | | than we're claiming it should still be considered an exact match. This would previously leak frags that had been extended. - If there is a sequence number problem in the journal print the sequence numbers we've seen so far for debugging. - Clean up the block mask related debuging printfs. Some are redundant. MFC after: 1 week
* Fix some nearby type and style errors.mdf2012-09-283-17/+14
| | | | Pointed out by: bde
* Fix sbin/ build with a 64-bit ino_t.mdf2012-09-271-1/+1
| | | | Original code by: Gleb Kurtsou
* Fix fsck_ffs build with a 64-bit ino_t.mdf2012-09-278-85/+103
| | | | Original code by: Gleb Kurtsou
* - Fix a typo in debug message.zont2012-09-131-1/+1
| | | | | Approved by: kib (mentor) MFC after: 3 days
* Remove needless (int) casts of write(2)'s 3rd argument.obrien2012-09-122-5/+5
| | | | | Also change blwrite() 'size' parameter to a ssize_t to better match write(2).
* Simply printf-like strings and outdent strings so that it is easy to seeobrien2012-09-121-20/+18
| | | | if they fit on a standard terminal.
* fsck_ffs shall accept the configured journal size, and not refuse tokib2012-08-021-1/+1
| | | | | | | | | | operate on it if journal size is greater then SUJ_MAX. The later constant is only to select maximal journal size when user did not specified size explicitely. Submitted by: Andrey Zonov <andrey@zonov.org> Reviewed by: mckusick MFC after: 1 week
* For incompleted block allocations or frees, the inode block count usagekib2012-06-121-0/+15
| | | | | | | | | | | | | | | must be recalculated. The blk_check pass of suj checker explicitely marks inodes which owned such blocks as needing block count adjustment. But ino_adjblks() is only called by cg_trunc pass, which is performed before blk_check. As result, the block use count for such inodes is left wrong. This causes full fsck run after journaled run to still find inconsistencies like 'INCORRECT BLOCK COUNT I=14557 (328 should be 0)' in phase 1. Fix this issue by running additional adj_blk pass after blk_check, which updates the field. Reviewed by: jeff, mckusick MFC after: 1 week
* Be more helpful about alternate superblocks.trasz2012-02-102-2/+7
|
* Fix warning when compiling with gcc46:eadler2012-01-101-2/+1
| | | | | | | | error: variable 'blksfree' set but not used Reviewed by: pjd Approved by: dim MFC after: 3 days
* Spelling fixes for sbin/uqs2012-01-072-2/+2
|
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-1/+1
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* Change the type of real_dev_bsize variable from long to u_int.kib2011-12-202-2/+2
| | | | | | | | | | The DIOCGSECTORSIZE takes u_int * as an argument, using long * causes failures on big-endian targets. Diagnosed by: Michiel Boland <boland37 xs4all nl> PR: sparc64/163460 Tested by: pho (x86), flo (sparc64) MFC after: 1 week
* Forgot this nit in r221107.des2011-09-031-1/+1
| | | | Approved by: re (kib)
* Fix the check in dircheck() on namlen.delphij2011-09-021-2/+2
| | | | | | | | | | | | | | The value of namlen is copied from on-disk d_namlen, which is a 8-bit unsigned integer which can never exceed MAXNAMLEN (255) so the test is always true. Moreover, UFS does not allow d_namelen being zero. Change namlen from u_int to u_int8_t, and replace the unneeded test with a useful test. PR: bin/160339 Submitted by: Eugene Grosbein <eugen grosbein.pp.ru> MFC after: 2 weeks Approved by: re (kib)
* Break out the pass 5 inode and block map updating into a separate functionmckusick2011-07-152-28/+45
| | | | so that the function can be used by the journaling soft updates recovery.
* - Handle the JOP_SYNC case as appropriate.jeff2011-06-301-0/+1
| | | | Reported by: pho
* Implement fully asynchronous partial truncation with softupdates journalingjeff2011-06-101-36/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to resolve errors which can cause corruption on recovery with the old synchronous mechanism. - Append partial truncation freework structures to indirdeps while truncation is proceeding. These prevent new block pointers from becoming valid until truncation completes and serialize truncations. - On completion of a partial truncate journal work waits for zeroed pointers to hit indirects. - softdep_journal_freeblocks() handles last frag allocation and last block zeroing. - vtruncbuf/ffs_page_remove moved into softdep_*_freeblocks() so it is only implemented in one place. - Block allocation failure handling moved up one level so it does not proceed with buf locks held. This permits us to do more extensive reclaims when filesystem space is exhausted. - softdep_sync_metadata() is broken into two parts, the first executes once at the start of ffs_syncvnode() and flushes truncations and inode dependencies. The second is called on each locked buf. This eliminates excessive looping and rollbacks. - Improve the mechanism in process_worklist_item() that handles acquiring vnode locks for handle_workitem_remove() so that it works more generally and does not loop excessively over the same worklist items on each call. - Don't corrupt directories by zeroing the tail in fsck. This is only done for regular files. - Push a fsync complete record for files that need it so the checker knows a truncation in the journal is no longer valid. Discussed with: mckusick, kib (ffs_pages_remove and ffs_truncate parts) Tested by: pho
* Add an -E option to mirror newfs's. The idea is that if you have a systemdes2011-04-295-7/+67
| | | | | | | | | | | | | | | | | | | 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
* Mechanical whitespace cleanup.des2011-04-276-36/+35
| | | | MFC after: 3 weeks
* Fix boo-boo in previous commit.des2011-04-271-7/+7
| | | | MFC after: 3 weeks
* Alphabetize the options. No date bump since no actual change to the text.des2011-04-271-4/+4
| | | | MFC after: 3 weeks
* In checker, read journal by sectors.kib2011-02-123-12/+19
| | | | | | | | | | | Due to UFS insistence to pretend that device sector size is 512 bytes, sector size is obtained from ioctl(DIOCGSECTORSIZE) for real devices, and from the label otherwise. The file images without label have to be made with 512 sector size. In collaboration with: pho Reviewed by: jeff Tested by: bz, pho
* The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilitiesmckusick2011-01-243-5/+6
| | | | | | | | | | | | | | include sys/time.h instead of time.h. This include is incorrect as per the manpages for the APIs and the POSIX definitions. This commit replaces sys/time.h where necessary with time.h. The commit also includes some minor style(9) header fixup in newfs. This commit is part of a larger effort by Garrett Cooper started in //depot/user/gcooper/posix-conformance-work/ -- to make FreeBSD more POSIX compliant. Submitted by: Garrett Cooper yanegomi at gmail dot com
* Move most of the remaining USD/PSD/SMM papers into share/docuqs2010-12-046-2367/+0
|
* Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki whilejoel2010-08-161-1/+1
| | | | | | translating these manual pages. Minor corrections by me. Submitted by: Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
* Fix typos and spelling mistakes.joel2010-08-061-1/+1
|
* One question mark per question; everything else is just exaggerating.bz2010-08-031-1/+1
| | | | | reply() will output a '?', when printing the question along with [yn], so no need to have another here.
* Note that foreground fsck should be run after a filesystem related panic.mckusick2010-07-231-0/+9
| | | | | Suggested by: Mikhail Teterin (mi@) MFC after: 1 week
* - Permit zero length directories as a handled inconsistency. This allowsjeff2010-07-061-46/+115
| | | | | | | | | directory truncation to proceed before the link has been cleared. This is accomplished by detecting a directory with no . or .. links and clearing the named directory entry in the parent. - Add a new function ino_remref() which handles the details of removing a reference to an inode as a result of a lost directory. There were some minor errors in various subcases of this routine.
* Improve fsck robustness for SU+J cases:delphij2010-06-222-60/+117
| | | | | | | | | | - 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.
* Add support to background fsck to delete zero-length directories.mckusick2010-05-202-1/+33
|
OpenPOWER on IntegriCloud