summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
Commit message (Collapse)AuthorAgeFilesLines
* Sync with HEAD.obrien2013-02-081-10/+8
|\
| * - 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
| |
| \
| \
| \
*---. \ Sync from headsjg2012-11-049-123/+151
|\ \ \ \ | | |_|/ | |/| |
| * | | 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
* | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-221-0/+20
|/ | | | Requested by: Simon Gerraty <sjg@juniper.net>
* 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
|
* suj.c seems to contain two versions of the code.pjd2010-04-241-2065/+0
| | | | Remove the one that doesn't compile.
* Protect fsck.h from being included twice.pjd2010-04-241-0/+5
|
* - Merge soft-updates journaling from projects/suj/head into head. Thisjeff2010-04-246-289/+4739
| | | | | | | | 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
* Cast 64-bit quantity to intptr_t rather than int so as to work properlymckusick2010-01-111-2/+2
| | | | | | with 64-bit architectures (such as amd64). Reported by: Xin LI and Josh Paetzel
* This update utilizes new fsck sysctl commands that allow fsck runningmckusick2010-01-111-7/+82
| | | | | | | | | | in background mode to correct expected inconsistencies that arise during directory rename (see immediately previous update to this file for details). If run on a kernel without the new functionality, background fsck will simply ignore these inconsistencies rather than fail. Reported by: jeff
* When renaming a directory it passes through several intermediatemckusick2010-01-111-21/+109
| | | | | | | | | | | | | | | | | | | | | | | | states. First its new name will be created causing it to have two names (from possibly different parents). Next, if it has different parents, its value of ".." will be changed from pointing to the old parent to pointing to the new parent. Concurrently, its old name will be removed bringing it back into a consistent state. When fsck encounters an extra name for a directory, it offers to remove the "extraneous hard link"; when it finds that the names have been changed but the update to ".." has not happened, it offers to rewrite ".." to point at the correct parent. Both of these changes were considered unexpected so would cause fsck in preen mode or fsck in background mode to fail with the need to run fsck manually to fix these problems. This update changes these errors to be expected so that in preen mode fsck will simply fix these transitional errors. For now, background fsck will note these errors, but will need additional kernel support to fix them, so will simply ignore them rather than fail. A future update will allow background fsck to fix these problems. Reported by: jeff
* Add some error messages suggested in PR bin/138043. The code tomckusick2010-01-072-3/+12
| | | | | | | correct the problem was added in r176575 by delphij on 2008-02-25. PR: 138043 Reported by: Heikki Suonsivu
* This corrects a bug that manifested itself as identifying the lastmckusick2010-01-071-1/+1
| | | | | | | | | | cylinder group of a UFS1 filesystem as bad. The error was in the check and not in the cylinder group itself. So even though fsck fixed the cylinder group correctly, it was still endlessly reported as bad. PR: 141992 MFC after: 2 weeks Reported by: Dan Strick
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.antoine2009-12-281-1/+1
| | | | | | | | | Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used. PR: 137213 Submitted by: Eygene Ryabinkin (initial version) MFC after: 1 month
* Correct comment.pjd2009-06-031-1/+1
|
* - Use volatile for signal variables.lulf2009-06-021-2/+2
| | | | Suggested by: Jaakko Heinonen <jh -at- saunalahti.fi>
* - Use sig_atomic_t for signal handler variables.lulf2009-05-291-2/+2
| | | | MFC after: 1 week
* Update the actions previously attempted by the -D option to make themmckusick2009-02-046-76/+205
| | | | | | | | | | | | | | | | | | robust. With these changes fsck is now able to detect and reliably rebuild corrupted cylinder group maps. The -D option is no longer necessary as it has been replaced by a prompt asking whether the corrupted cylinder group should be rebuilt and doing so when requested. These actions are only offered and taken when running fsck in manual mode. Corrupted cylinder groups found during preen mode cause the fsck to fail. Add the -r option to free up excess unused inodes. Decreasing the number of preallocated inodes reduces the running time of future runs of fsck and frees up space that can allocated to files. The -r option is ignored when running in preen mode. Reviewed by: Xin LI <delphij@> Sponsored by: Rsync.net
* Add the '-C' "check clean" flag. If the FS is marked clean, skip fileobrien2009-01-304-11/+24
| | | | | | | | system checking. However, if the file system is not clean, perform a full fsck. Reviewed by: delphij Obtained from: Juniper Networks
OpenPOWER on IntegriCloud