Commit Graph

75 Commits (817e49e3ce0a70252113438440fc12607140d032)

Author SHA1 Message Date
Theodore Ts'o a435ec3449 Add support for backing up the journal inode location in the
superblock.  E2fsck will automatically save the journal information
in the superblock if it is not there already, and will use it if the
journal inode appears to be corrupted.  ext2fs_add_journal_inode() 
will also save the backup information, so that new filesystems
created by mke2fs and filesystems that have journals added via
tune2fs will also have journal location written to the superblock as
well.  Debugfs's logdump command has been enhanced so that it can
use the journal information in the superblock.

The debugfs man page has been improved to more fully describe the
logdump command.

Added two new functions, ext2fs_file_open2() and 
ext2fs_inode_io_intern2() which take a pointer to an inode structure;
this is needed so that e2fsck and debugfs can synthesize a
fake journal inode and use it to access the journal.
2003-08-21 00:40:26 -04:00
Theodore Ts'o d3128ccb06 Fix spelling error in e2fsck problem reporting. 2003-06-24 18:06:03 -04:00
Theodore Ts'o ddc32a045b Add Czech translation.
Remove "NYC" translation.  Add Czech translation from Miloslav 
Trmac <mitr@volny.cz>

Random NLS and other display fixes from Miloslav.
2003-05-03 18:45:55 -04:00
Theodore Ts'o 0926668d3a e2fsck/pass2.c (check_dir_block): Check for duplicate filenames within
a single directory block (because this is the easy case;
	we don't currently check for duplicates that span
	directory blocks, for now.  Eventually for htree
	directories we can do this by searching for all directory
	blocks that have a hash overflow, and then searching the
	adjacent blocks to find all other potential duplicates.)
2003-03-14 22:19:10 -05:00
Theodore Ts'o b0700a1b60 Change e2fsck to detect and offer to delete or rename duplicate
filenames in directories when rebuilding directories using
"e2fsck -fD /dev/XXX"
2003-03-14 01:43:56 -05:00
Theodore Ts'o 68ef5e1f4c Fix typo (errant extra character). 2002-12-11 12:14:43 -05:00
Theodore Ts'o 54779c66e0 Update to deal with the fact that the INDEX_FL code in the ext2 2.4
code accidentally had the INDEX_FL backwards compatibility code
removed.   E2fsck will now fix HTREE corruptions in preen mode, and
mke2fs will not create filesystems with the dir_index flag set
by default.  (The user has to specifically request it.)
2002-11-13 07:00:16 -05:00
Theodore Ts'o ad4fa46604 Avoid counting directory entries during a directory salvage.
Add additional checks to HTREE directories.  We now check the count
and limit fields in the htree header, as well as assuring that the
hash table in each interior node is in ascending order.  We also
check to make sure all leaf nodes are have the expected depth in 
the tree.

Updated test cases to deal with all of the above.
2002-09-30 11:19:19 -04:00
Theodore Ts'o ea1959f015 Fix a bug which caused e2fsck to fail to correctly check filesystems
using a non-zero hash version (i.e., half MD4 or TEA hash).

The hash version wasn't getting copied into dx_dir->hashversion and
this caused the kernel to treat all directories if they were using the 
legacy hash, which was Bad.
2002-08-31 02:32:41 -04:00
Theodore Ts'o a3da9d1df7 problem.c: Fix PR_1_RELOC_BLOCK_ALLOCATE message to explain that
it is necessary to find contiguous blocks in a particular
	block group.
2002-08-21 12:52:03 -04:00
Theodore Ts'o 0684a4f33b Overhaul extended attribute handling. Should now be correct with
respect to the latest V2 bestbits ACL code.
2002-08-17 10:19:44 -04:00
Theodore Ts'o 850d05e9aa Add e2fsck -D option which optimizes/compresses directories.
General cleanup of rehash code.  (Fixed a few bugs, reformatted
code to make it more maintainable, etc.)
2002-07-25 00:00:08 -04:00
Theodore Ts'o b7a00563b2 Add support to e2fsck to reindex directories to use hash trees. 2002-07-20 00:28:07 -04:00
Theodore Ts'o 503f9e7f6e Add support for the half-MD4 HTREE hash.
Add HTREE root node tests.
2002-06-26 16:52:10 -04:00
Theodore Ts'o 8fdc9985c1 Add initial support for htree directories. 2002-06-25 23:26:34 -04:00
Theodore Ts'o da307041e7 Check for inodes which are too big (either too many blocks, or
would cause i_size to be too big), and offer to truncate the inode.
Remove old bogus i_size checks.

Add test case which tests e2fsck's handling of large sparse files.
Older e2fsck with the old(er) bogus i_size checks didn't handle
this correctly.
2002-05-21 21:19:14 -04:00
Theodore Ts'o bcf9c5d401 Fix up Andreas' changeset. Avoid use of dynamic automatic arrays,
and check for EXT2_INDEX_FL for special devices, and consider them to
be invalid if they are set.
2002-05-21 09:14:17 -04:00
Andreas Dilger b94a052a25 Add more complete tests for symlinks: nul termination of long links and length
Improve the f_badsymlinks test case for these new tests.
2002-05-18 13:16:30 -06:00
Theodore Ts'o f122632e6b E2fsck now prints ranges in pass 5 when printing deltas in
the block and inode bitmaps.
2002-03-07 02:47:07 -05:00
Theodore Ts'o 6a50c5ed57 Use ctx->filesystem_name if the ctx->device_name is NULL in e2fsck. 2001-12-21 23:29:35 -05:00
Theodore Ts'o d37066a9fa Give the opportunity for e2fsck to run the journal even if
recovery flag is cleared.  If we're using a backup
superblock, run the journal by default.
2001-12-21 23:28:54 -05:00
Theodore Ts'o 62e3e7fe4f journal.c (clear_v2_journal_fields, e2fsck_journal_load): If the
V2 fields are set on a V1 journal superblock, or an
	internal V2 journal has s_nr_users is non-zero, clear the
	entire journal superblock beyond the V1 superblock.  This
	fixes botched V1->V2 updates.

problem.c, problem.h (PR_0_CLEAR_V2_JOURNAL): Add new problem code.

f_bad_local_jnl: New test which tests for a V2 journal with bad 
	fields caused by a botched V1->V2 upgrade.
2001-10-07 02:13:30 -04:00
Theodore Ts'o 773fd8a1d4 e2fsck.h, journal.c (e2fsck_move_ext3_journal): Add new function
which will automatically relocate the ext3 journal from a
	visible file to an invisible journal file if the
	filesystem has been opened read/write.

super.c (check_super_block): Add call to e2fsck_move_ext3_journal

problem.c, problem.h (PR_0_MOVE_JOURNAL, PR_0_ERR_MOVE_JOURNAL):
	Add new problem codes.
2001-10-06 21:26:27 -04:00
Theodore Ts'o a474269147 pass1.c, pass2.c, problem.c, problem.h: Fix bug introduced by
Andreas's symlink code; check_blocks() was unconditionally testing
	inode_bad_map without checking to see if it existed first.  Fixed
	problem a different way; we now no longer check inode_bad_map at all,
	since the file might not get deleted in pass 2 anyway.  We move the
	large file feature reconciliation code to to e2fsck_pass2(), and in
	deallocate_inode() in pass2.c, we decrement the large files counter if
	we're about to delete a large file.
2001-08-09 04:14:04 -04:00
Andreas Dilger fcdebce7df Change comments for %D and %d expansion in e2fsck problem codes. It
was not consistent which was for dirent expansion, and which was for
directory number expansion.
2001-08-04 01:47:01 -06:00
Theodore Ts'o d007cb4cbb Cleanup changes to Andreas' symlink patch. Remove use of EXT2_LINK_DIR
Also cleaned up the symlink handling code to make it a bit more
compact and to test for a bad symlink block earlier.
2001-08-04 20:39:39 -04:00
Andreas Dilger 67052a8aee Add extra checks for bad symlinks, including zero length symlinks,
too long i_size for slow and fast symlinks, i_size_high set, multiple
blocks for slow symlinks.
2001-08-04 00:51:18 -06:00
Theodore Ts'o a092c563f7 Update problem message printed when special files have the immutable
flag set.  Update the f_filetype test case.
2001-07-27 22:40:09 -04:00
Theodore Ts'o 14fe1c3314 Apply fixes reported by Andreas Gruenbacher:
pass1.c (check_ext_attr): Skip zero-length EA entries.

problem.c: PR_1_EA_ALLOC_COLLISION shouldn't abort, but should prompt
	to clear the EA block.
2001-07-25 19:48:24 -04:00
Theodore Ts'o adee8d75db Add support for use of an external journal (so long as the external
journal only has one filesystem).
2001-07-23 00:17:49 -04:00
Theodore Ts'o 55fd07ed0a This patch completes the initial extended attribute/ACL support for
e2fsck.  We now check the entire EA block to make sure that the all
of the EA entries look sane.
2001-07-19 16:31:25 -04:00
Theodore Ts'o e8a3ee628a Add code to check and fix incorrect reference counts in the extended
attribute blocks.
2001-07-07 11:12:50 -04:00
Theodore Ts'o 342d847db3 Add initial support for extended attribute blocks 2001-07-02 11:54:09 -04:00
Theodore Ts'o f76ad46200 problem.c:
Fix tabbing/indenting from Andreas.
2001-06-14 06:58:33 +00:00
Theodore Ts'o fdbdea09b8 ChangeLog, pass1.c, pass2.c, problem.c, problem.h:
pass1.c (mark_inode_bad): Replace alloc_bad_map with a function which
  	sets the bit in the bad inode bitmap.
  	(e2fsck_pass1): Check for fast symlinks with an invalid size, and set
  	the bad inode map in that case.
  pass2.c (e2fsck_process_bad_inode): Check for fast symlinks with an
  	invalid size and prompt the user if the inode should be cleared.
  problem.h, problem.c (PR_2_SYMLINK_SIZE): Added new problem code.
2001-06-02 04:26:26 +00:00
Theodore Ts'o 2f686ace1c ChangeLog, journal.c, problem.c, problem.h:
problem.c, problem.h: Change PR_0_JOURNAL_UNSUPP_INCOMPAT and
  	PR_0_JOURNAL_UNSUPP_ROCOMPAT so they aren't fatal errors, but prompt
  	to see if the user should abort.  Removed the
  	PR_0_JOURNAL_RESET_COMPAT problem code.
  journal.c (e2fsck_journal_load): If there are incompatible journal
  	flags, just return an error code.
  	(e2fsck_check_ext3_journal): If e2fsck_journal_load returns an error
  	code indicating that there are incompatible journal flag, check to see
  	if we should abort, and then offer to clear the journal.
2001-06-02 00:38:40 +00:00
Theodore Ts'o c7f23364fd ChangeLog, journal.c, problem.c, problem.h:
journal.c (e2fsck_journal_reset_super): Fix bug; the reset journal
  	wasn't getting written out to disk since the dirty bit wasn't being
  	set on the buffer.
  	(e2fsck_journal_load): Don't print an error message if the journal
  	version number is wrong; just return a error code reflecting this
  	fact.  If the block type in the journal superblcok is obviously not a
  	version number, report the journal is corrupted.
  	(e2fsck_check_ext3_journal): On an unsupported journal version, prompt
  	to abort by default, but then offer a chance to clear the journal as
  	corrupt.
  problem.c, problem.h (PR_0_JOURNAL_UNSUPP_VERSION): Added new problem code.
2001-05-23 22:19:47 +00:00
Theodore Ts'o 21afac096d ChangeLog, pass1.c, problem.c, problem.h, problemP.h:
pass1.c: Treat inodes with a low dtime (that were from a corrupted
  	orphan list) specially.
  problem.c, problem.h: Add new problem codes PR_1_LOW_DTIME and
  	PR_1_ORPHAN_LIST_REFUGEES, and a new latch group, PR_LATCH_LOW_DTIME.
  problemP.h: Expand the size of the problem flag to be an int instead
  	of a short.  Expand space in the flag word which is reserved for
  	problem latch flags from 3 bits to 8 bits.
ChangeLog, expect.1, expect.2, image.gz, name:
  f_badorphan: New test which verifies corrupted orphan list handling.
2001-05-14 12:47:41 +00:00
Theodore Ts'o 424cd2beb7 ChangeLog, e2fsck.h, journal.c, problem.c, problem.h, super.c:
super.c (check_super_block): Be more strict on checking
  	s_r_blocks_count superblock field.
  problem.c, problem.h (PR_0_JOURNAL_UNSUPP_ROCOMPAT,
  	PR_0_JOURNAL_UNSUPP_INCOMPAT, PR_0_JOURNAL_RESET_COMPAT): New problem
  	codes.
  journal.c (e2fsck_journal_load): Use a problem code to report
  	unsupported feature flags.  There is code to clear unsupported flags,
  	but since this is dangerous, it's not allowed in the problem code
  	table.
  journal.c (e2fsck_journal_reset_super): initialize the journal
  	sequence number to a random value to avoid recovering bad transactions
  	from a corrupt journal.
2001-05-14 04:06:56 +00:00
Theodore Ts'o 67a473ecb9 problem.c:
Add quick compression of journal -> @j
jfs.h:
  Eliminate force of JFS_DEBUG for userspace
2001-02-08 02:34:50 +00:00
Theodore Ts'o a9ca2016e1 ChangeLog, pass1.c, problem.c, problem.h:
pass1.c (e2fsck_pass1): Cap the maximum legal size of a file by the
  	limit caused by the fact that i_blocks is in 512 byte units, and that
  	the Linux buffer cache also fundamentally assumes 512 byte sectors.
  	Make sure that the journal inode is a regular file, and when clearing
  	an unused journal inode, make sure the icount db is updated.
  problem.c, problem.h (PR_1_JOURNAL_BAD_MODE): Add new problem code.
ChangeLog, journal.c:
  journal.c (e2fsck_journal_fix_unsupported_super): Remove unused
  	function.  Add FIXME notes to e2fsck_get_journal(), from Andreas
  	Dilger.
2001-01-12 21:53:25 +00:00
Theodore Ts'o 37b6b2975f ChangeLog, problem.c:
problem.c: For PR_1_RESERVED_BAD_MODE, print a description of the
  	reserved inode.  In PR_0_JOURNAL_HAS_JOURNAL, prompt to clear the
  	journal, rather than deleting it (which is more accurate).  (From
  	Andreas Dilger.)
2001-01-12 21:16:13 +00:00
Theodore Ts'o 7e92dfae9e ChangeLog, journal.c, problem.c:
journal.c (e2fsck_journal_fix_bad_inode): Set pctx->ino to the bad
  	journal number.
  problem.c (PR_0_JOURNAL_BAD_INODE): Use pctx->ino instead of pctx->num
  	when printing the bad journal inode number.
2001-01-12 15:30:25 +00:00
Theodore Ts'o 95a5bc918f ChangeLog, problem.c:
problem.c: Fix another broken @F vs @f problem.
2001-01-11 04:58:21 +00:00
Theodore Ts'o d74edf4e86 ChangeLog, message.c, problem.c:
Whoops, @d was already taken by "directory".  Use @v for device, and
  re-order the listing of at-expansions to avoid this problem in the
  future.
2001-01-03 19:38:04 +00:00
Theodore Ts'o f18996c8eb ChangeLog, pass1.c, problem.c, problem.h:
pass1.c (e2fsck_pass1): Moved journal inode handling out to its own
  	block; if the journal inode is not in use, and it contains data, offer
  	to clear it.
  problem.h, problem.c (PR1_JOURNAL_INODE_NOT_CLEAR): Add new problem
  	code.
  problem.c: Modified problem table to use a new abbreviations.
2001-01-03 16:57:24 +00:00
Theodore Ts'o 060b5fbf80 ChangeLog, problem.c, problem.h:
problem.c, problem.h (PR_0_FS_REV_LEVEL, PR_1_FS_REV_LEVEL): Add new
  	problem codes.
2000-12-13 18:07:23 +00:00
Theodore Ts'o 133a56dc9d ChangeLog, message.c, pass1b.c, pass2.c, pass3.c, problem.c, problem.h:
pass1b.c: Change routines to use PR_1B_BLOCK_ITERATE when reporting
  	problems rather than using com_err directly.
  problem.c, problem.h (PR_1B_BLOCK_ITERATE): Add new problem code.
  message.c (expand_percent_expression): Add safety check.  If ctx->str
  	is NULL, print "NULL" instead of dereferencing the null pointer.
  pass1b.c, pass2.c, pass3.c: Change calls to ext2fs_block_iterate to
  	ext2fs_block_iterate2, to support 64-bit filesizes and to speed things
  	up slightly by avoiding the use of the ext2fs_block_iterate's
  	compatibility shim layer.
version.h:
  Update for WIP release.
2000-11-17 05:40:49 +00:00
Theodore Ts'o 8394902e04 ChangeLog, journal.c, problem.c, problem.h, super.c:
super.c (release_inode_block, release_inode_blocks,
  	release_orphan_inodes): Add code to deal with truncating inodes which
  	are still in use (but which are on the orphan list because they need
  	truncation).
  problem.c, problem.h: Rename PR_0_CLEAR_ORPHAN_INODE to
  	PR_0_ORPHAN_CLEAR_INODE, and remove PR_0_ORPHAN_INODE_INUSE.
  journal.c (e2fsck_run_ext3_journal): Add i18n support, and print a
  	message when the journal is being recovered.
2000-10-25 01:38:50 +00:00
Theodore Ts'o ecf1b7767e ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
  	e2fsck_check_ext3_journal to smash the journal because
  	journal->j_transaction_sequence wasn't getting initialized.
  journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
  	to e2fsck_clear_recover from recover_ext3_journal to after the
  	filesystem has been closed and reopened.  Otherwise, the superblock in
  	the filesystem handle will probably be stale, and will overwrite the
  	newer version of the superblock written by the log recovery.
  message.c (expand_inode_expression): Add support for %Iu and %Ig
  problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
  super.c (release_orphan_inodes, release_inode_block,
  	release_inode_blocks): Update the block group descriptor counts when
  	freeing the orphan inode.  Use PR_0_CLEAR_ORPHAN_INODE to report when
  	we clear an orphan.
  journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
  	reopen the filesystem using the device name instead of the filesystem
  	name.
2000-08-20 22:06:31 +00:00