Commit Graph

561 Commits (4b5d342b47867dee13f6037e8a11291b12d31fdd)

Author SHA1 Message Date
Matthias Andree 4b13704cbe Fix crash when /proc/acpi/ac_adapter/ is not present, for instance,
on pre-ACPI and non-Linux systems.
2005-01-13 03:35:29 +01:00
Theodore Ts'o d2ee56d86e Fix configure.in to use AC_CHECK_TYPES instead of the "broken by design"
autoconf 2.13 version of AC_CHECK_TYPE.  Otherwise, on some platforms
intptr_t might get erroneously #define'd to be long.   (Addresses 
Debian Bug #289133)
2005-01-09 00:57:45 -05:00
Theodore Ts'o 22ba4c1ded Make tune2fs and e2fsck consistent about allowing at most 50% of the blocks
in a filesystem to be reserved for allocation by the root user.
2005-01-06 14:05:17 -05:00
Theodore Ts'o dc8ce34637 Fix resize inode handling on big endian systems, by adding new routines
that read/write indirect blocks, byte swapping them if necessary.
2005-01-06 00:04:24 -05:00
Theodore Ts'o c3ffaf833b Add support to detect corrupted resize_inode's to e2fsck. 2004-12-24 01:42:22 -05:00
Theodore Ts'o 71669d0541 Avoid some potential inode cache coherency problem caused by using the
byte-swapping options to e2fsck.  This was the cause of some hard to 
reproduce problems that had been reported in the past, and which the
resize_inode changes tickled in a much more repeatable fashion.
2004-12-23 21:49:05 -05:00
Theodore Ts'o e75cfc5da8 Fix e2fsck so that it will clean up filesystesm that have the
resize_inode capability disabled, but which still have the
s_reserved_gdt_blocks field set in the superblock, or which 
still have blocks in the inode #7 (the resize inode).
2004-12-16 20:13:45 -05:00
Theodore Ts'o 22c6821a24 Supplied changelog for resize inode patch. 2004-12-15 17:26:32 -05:00
Theodore Ts'o d323f8fb36 Add support for on-line resizing ala the resize inode. This patch
is taken from Fedora Core 3's e2fsprogs 1.35-11.2.src.rpm's 
e2fsprogs-resize.patch.
2004-12-15 14:39:16 -05:00
Theodore Ts'o acb79d9d19 Fix stupid core dumping bug if the TZ environment variable isn't set. 2004-12-15 12:21:41 -05:00
Theodore Ts'o 522798d342 Add install-strip and install-shlibs-strip targets
Use Linux-kernel-style makefile output for "make install"

Update intl/Makefile.in to version from gettext 0.14.1
2004-12-15 11:28:55 -05:00
Theodore Ts'o 6d4022786d Use MKINSTALLDIRS macro so that the Makefiles can find the script
correctly.

Update Makefile dependencies.

Update "make depend" production so that it filters out comments
inserted by newer gcc compilers.

Remove sync from e2fsck's "make all" target.
2004-12-14 21:46:26 -05:00
Theodore Ts'o 8ff1a86005 If the TZ environment variable is set to GMT, use gmtime()
instead of localtime() or ctime() to force the use of GMT.  
This is because the dietlibc doesn't honor the TZ environment 
variable.
2004-11-30 19:57:20 -05:00
Theodore Ts'o 2e8ca9a26b Add support for passing options to the io layer using the URL syntax. For
example, /tmp/test.img?offset=1024.  Multiple options can separated using
the & character, although at the moment the only option implemented is
the offset option in the unix_io layer.
2004-11-30 14:07:11 -05:00
Theodore Ts'o 47204ff983 Use Linux-kernel-style makefile output to make it easier to
see errors/warnings.
2004-11-30 10:52:27 -05:00
Richard Mortimer 6e4fbbeb50 Attempt recovery if the journal contains illegal blocks 2004-10-04 17:56:24 +01:00
Theodore Ts'o 8421fb67f2 pass1.c (process_block): Change the limit of directory size from
32 MB to 2GB.
2004-07-26 20:11:49 -04:00
Theodore Ts'o 93effaa456 Fixed potential ordering constraint problem in e2fsck's journal
recovery code by implementing the sync_blockdev function.  Thanks to
Junfeng Yang from the Stanford Metacompilation group for pointing this
out.
2004-05-26 20:58:45 -04:00
Theodore Ts'o aa5c0a4562 Remove .cvsignore files; they were out of date, and causes lintian
to flame about their presence in the source tarball.
2004-05-05 09:02:36 -04:00
Theodore Ts'o 66fbee8cbb unix.c (check_if_skip): If the checkinterval is zero, then
disregard it when calculating when the next check will
	take place by e2fsck.
2004-05-04 20:38:17 -04:00
Theodore Ts'o c07f9f2639 In e2fsck, when trying to determine if the system is running on
battery, be more flexible about the name of the ACPI device that
corresponds to the AC adapter.  (Addresses Debian bug #242136)
2004-04-12 00:16:44 -04:00
Theodore Ts'o dd60705665 Refine the build process to avoid re-running subst all the time on
some generated files, by having subst update the modtime on these 
files even when the generated file hasn't changed.  We do this with 
generated files that do not have any downstream dependencies.
2004-04-03 13:53:46 -05:00
Matthias Andree 83e692e88b unix_io.c, pass1.c:
int -> unsigned for 1 bit wide bitfields - we cannot have a value and a sign in 1 bit.
  Fixes some of the Intel C++ 8.0 warnings (-w1 level).
2004-03-30 04:17:14 +02:00
Theodore Ts'o b70b1167fe Update version number for e2fsprogs 1.35 release. 2004-02-28 10:52:35 -05:00
Theodore Ts'o bc69f82db8 Add missing break statement so e2fsck -k actually works.
(Addresses Debian Bug #234993)
2004-02-27 10:39:27 -05:00
Theodore Ts'o 4fb9d52ba6 unix.c (main, PRS), e2fsck.8.in: Add a new -k option which keeps
the existing badblocks list when using the -c option.
	(Addresses Debian bug #229103)
2004-02-24 00:16:09 -05:00
Theodore Ts'o ed52f62bbd Makefile.in (PROFILED_LIBS, PROFILED_DEPLIBS): Fix reference to
libblkid so that the build will work with --enable-profile
	(Addresses Sourceforge bug #811408)
2004-02-23 21:26:23 -05:00
Theodore Ts'o 151786fc55 Fix up preen mode messages during pass 1B/C/D. 2004-02-22 15:41:11 -05:00
Theodore Ts'o bbbc92f2ed e2fsck.c (e2fsck_run): Clear the SETJMP_OK flag when returning
so we don't double longjump into an invalid stack frame.
	(Thanks to Matthias Andree for providing this fix.)
2004-02-21 20:53:03 -05:00
Theodore Ts'o 489f00248f problem.c (fix_problem): Don't call print_e2fsck_message if the
message is empty; otherwise, the NLS substitution will
	print the .po header, which is Just Wrong.
2004-01-31 21:24:51 -05:00
Theodore Ts'o 1ba7a2f2b6 Fix a byte swap bugs, including one which caused e2fsck to
incorrectly treat as valid symlinks created with SE Linux 
(Debian bug #228723) as well as failing the f_journal test case on 
big endian systems due to the backup journal blocks not being swapped.
2004-01-30 01:48:06 -05:00
Matthias Andree b34cbddbd6 Re-add FreeBSD support.
Tested on FreeBSD 5.2-CURRENT as of 2003-12-28.
Tested on FreeBSD 4.9-STABLE  as of 2003-12-27.
2003-12-28 18:21:26 +01:00
Matthias Andree b969b1b8a5 Fix more compiler warnings. 2003-12-28 13:04:35 +01:00
Theodore Ts'o 2e5fcce05e Fix bug in e2fsck: When reconnecting a directory, we may
need to create a lost+found directory.  This may
invalidate our pointer to the directory information, so we
must look it up again after calling
e2fsck_reconnect_file().  (Addresses Debian bug #219640).
2003-12-12 03:00:56 -05:00
Theodore Ts'o 6c7d61da00 e2fsck.h (E2F_FLAG_RESTARTED): Assign a unique flag bitfield to
E2F_FLAG_RESTARTED.  This fixes a bug where if the user
	specifies an alternate superblock, and the journal needs
	to be replayed, e2fsck would erroneously assume that
	journal had been run already without clearing the
	NEEDS_RECOVERY flag, and bomb out with an error.
2003-12-11 01:00:21 -05:00
Theodore Ts'o 544349270e Fix gcc -Wall nitpicks 2003-12-07 01:28:50 -05:00
Theodore Ts'o 3de085dd41 recovery.c, jfs_user.h: Sync recovery.c with latest 2.5 kernel
version.
2003-12-07 01:00:02 -05:00
Theodore Ts'o 3ddf2f662e When testing a disk using e2fsck -c, use the list
of new bad blocks to replace the current list of bad
blocks.  This way "e2fsck -c" can be used to recover from
a corrupted bad block inode.
2003-12-02 07:56:42 -05:00
Theodore Ts'o 015b03df7d In e2fsck, given an extra grace period before actually forcing
a filesystem check if a laptop system reports it is running on
battery.  This way the laptop will be biased to waiting until
it is on AC power before doing a filesystem check.  (Addresses
Debian bug #205177)
2003-11-21 11:02:22 -05:00
Theodore Ts'o 6de289cb10 In e2fsck, if the number of mounts until the next forced filesystem
check is 5 or less, mention this to the user.  (Addresses 
Debian bug #157194)
2003-11-21 10:54:54 -05:00
Theodore Ts'o 000ba4046f pass1.c (e2fsck_pass1), problem.h (PR_1_BB_FS_BLOCK),
problem.c (PR_1_BB_FS_BLOCK, PR_1_BBINODE_BAD_METABLOCK_PROMPT): 
	Fix up the handling of corrupted indirect blocks in the 
	bad block.  We now correctly handle the case where there
	is an overlap between a block group descriptor or
	a superblock and a bad block indirect block.  In the case
	where the indirect block is corrupted, we now suggest
	"e2fsck -c".
2003-11-21 10:41:58 -05:00
Theodore Ts'o 817e49e3ce Check the returned name from blkid_get_devname in tune2fs and
e2fsck, and print an error if the requested LABEL/UUID does 
not exist (previously, we core dumped!)
2003-11-21 09:10:29 -05:00
Theodore Ts'o ef344e13d2 Centeralize calculation of which blocks are reserved/used for
the superblock and block group descriptors into two functions:
ext2fs_reserve_super_and_bgd, found in lib/ext2fs/alloc_sb.c, and
ext2fs_super_and_bgd_lock, found in lib/ext2fs/close.c.

Change e2fsck/pass1.c (mark_table_blocks), lib/ext2fs/closefs.c
(ext2fs_flush), lib/ext2fs/initialize.c (ext2fs_initialize),
and misc/dumpe2fs.c (list_desc) to use these functions.

e2fsck/ChangeLog
    pass1.c (mark_table_blocks): Use the new function
    	ext2fs_reserve_super_and_bgd to calculate the blocks to be
    	reserved.

lib/ext2fs/ChangeLog
    closefs.c (ext2fs_super_and_bgd_loc): New function which
    	centralizes the calculation of the superblock and block
    	group descriptors.
    	(ext2fs_flush): Use ext2fs_super_and_bgd_lock to figure
    	out where to write the superblock and block group
    	descriptors.
    
    alloc_sb.c (ext2fs_reserve_super_and_bgd): New function which
    	reserves space in the block bitmap using
    	ext2fs_super_and_bgd_loc.
    
    initialize.c (ext2fs_initialize): Use
    	ext2fs_reserve_super_and_bgd to initialize the block bitmap.

misc/ChangeLog
    dumpe2fs.c (list_desc): Use ext2fs_super_and_bgd_loc to
    	determine the locations of the superblock and block group
     	descriptors.
2003-11-21 09:02:21 -05:00
Theodore Ts'o 557ddb2fdf util.c (get_backup_sb): Check to make sure the context is passed
in non-NULL before trying to dereference it.  Otherwise we
	might core dump when called to expand %S in a problem
	description.
2003-08-24 21:36:38 -04:00
Theodore Ts'o a7ac1df34f Adjust description line so that apropos "ext2" or "ext3" will
find all of the e2fsprogs man pages.  (Addresses Debian Bug #206845)
2003-08-24 17:56:41 -04:00
Theodore Ts'o 27479eb227 journal.c (e2fsck_move_ext3_journal): When moving the journal or
backing up the journal inode, make sure it gets written to
	all the superblocks.
2003-08-21 08:59:38 -04:00
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 54a31a3b2e e2fsck.h, unix.c (PRS, e2fsck_clear_progbar,
e2fsck_simple_progress): Don't print the ^A and ^B
	characters which bracket the progress bar when the e2fsck
	program is talking directly to a tty, but only when it is
	being piped to another program.  (Addresses Debian bug
	#204137)
unix.c: Move some initialized variables to the BSS segment to 
	shrink the size of the e2fsck executable.
2003-08-19 10:08:34 -04:00
Theodore Ts'o 0c193f8204 Include inttypes.h if present. New macros INT_TO_VOIDPTR and
VOIDPTR_TO_INT.  Use them throughout for int<->void *
	casts to fix 64-bit warnings.
2003-08-01 14:26:23 -04:00
Theodore Ts'o c4e3d3f374 ext2fs_getmem(), ext2fs_free_mem(), and ext2fs_resize_mem()
all now take a 'void *' instead of a 'void **' in order to 
avoid pointer aliasing problems with GCC 3.x.
2003-08-01 09:41:07 -04:00
Theodore Ts'o 9c7ec17809 Update for 1.34 release. 2003-07-26 01:03:34 -04:00
Theodore Ts'o 48e6e81362 Fixx gcc -Wall nitpicks. 2003-07-06 00:36:48 -04:00
Theodore Ts'o d3128ccb06 Fix spelling error in e2fsck problem reporting. 2003-06-24 18:06:03 -04:00
Theodore Ts'o 113e405bb6 unix.c (show_stats), e2fsck.h: Use ngettext (abbreivated with
the macro P_(str1, str2, n)) to simplify the statistics
	reporting.
2003-05-17 21:00:46 -04:00
Theodore Ts'o 2a29f1354f Add --enable-test-io-debug configure option which causes e2fsck and
tune2fs to use the test I/O manager.

The test I/O manager has been changed to not do anything extra by 
default, unless the TEST_IO_FLAGS and/or TEST_IO_BLOCK environment
variables are set, which controls what I/O operations are logged and
a block number to watch, respectively.  The log messages are sent to
stderr by default, unless a filename is specified via the 
TEST_IO_LOGFILE environment variable.
2003-05-05 12:08:47 -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 a04eba3f88 Update to gettext 0.11.5. We now enable NLS support by default.
Fixed up support for using the internal intl library.
2003-05-03 16:35:17 -04:00
Theodore Ts'o 6177c41f99 Fixed NLS support for message abbreviations in e2fsck. 2003-04-27 17:34:14 -04:00
Theodore Ts'o 71df0dc393 Update for 1.33 release.
Fix typo's in README.subset

Change debian control file so it doesn't bomb out if the EVMS FSIM
is not there, since it is not built on the Hurd.  Resolves Debian
bug #189687.
2003-04-21 16:17:09 -04:00
Theodore Ts'o 520ead378e Fix gcc -Wall warnings. 2003-04-19 13:48:27 -04:00
Theodore Ts'o 12dd69f5ff e2fsck/rehash.c (name_cmp): Sort the deleted inodes to the end
of the list, for portability to systems that whose qsort
	does not perform a stable sort.
2003-04-17 21:55:38 -04:00
Theodore Ts'o 908b785c3f Use setvbuf instead of setbuf to force stdout and
stderr to be non-buffered when the stdout/stderr are a pipe.
This fixes a cosmetic problem when using e2fsck under logsave.
2003-04-16 15:20:13 -04:00
Theodore Ts'o bc34d6be65 * Add support for the -a and -s options to logsave.
* Change e2fsck to bracket its progress bar output with ctrl-A and ctrl-B 
    characters, so that logsave -s can omit writing the progress bar output
    to the log file.
2003-04-16 14:05:06 -04:00
Theodore Ts'o 16fa86b9c5 Remove the debian-special legal permission notes. 2003-04-14 20:40:49 -04:00
Theodore Ts'o fff45483ed Add portability enhancements for Cygwin32 environment. 2003-04-13 00:44:19 -04:00
Theodore Ts'o 2a77a784a3 E2fsck now updates the global free block and
inode counters from the block group specific counters
quietly.  This is needed for an experimental patch which
eliminates locking the entire filesystem when allocating
blocks or inodes; if the filesystem is not unmounted
cleanly, the global counts may not be accurate.
2003-04-05 22:50:44 -05:00
Theodore Ts'o aa75ecccab Fix the Apple Darwin port. 2003-03-17 10:01:22 -05:00
Theodore Ts'o 6cca7ba96d Update dependency information in Makefiles 2003-03-16 20:21:16 -05:00
Theodore Ts'o 1d2eef4227 rehash.c (e2fsck_rehash_dir): If user specified the -n option,
skip trying to write out directory.
	(e2fsck_rehash_directories): Fix the percentage
	calculation in the progress bar.
2003-03-15 13:30:07 -05:00
Theodore Ts'o 52734dc532 Don't display progress bar when rebuilding directories unless
explicitly requested by the user.
2003-03-15 04:03:43 -05: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 e71d87317a Add Apple/Darwin patches. 2003-03-14 02:13:48 -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 77be4d2df1 Minor man page fixes (Addresses Debian bugs #173612, #175233,
#175113, and #170497)
2003-03-06 12:39:55 -05:00
Theodore Ts'o f364093b19 Update debugfs and e2fsck to use the blkid library. 2003-03-01 19:47:44 -05:00
Theodore Ts'o 19445ef970 Fixed up minor documentation issues (man page for badblocks and usage
message for e2fsck).
2003-01-29 21:04:52 -05:00
Theodore Ts'o 4f489285b6 pass1.c (check_blocks): Use the EXT2_I_SIZE macro. 2003-01-22 18:28:15 -05:00
Theodore Ts'o e34bf43aff pass2.c (strnlen): Provide strnlen if libc doesn't. 2002-12-18 18:28:10 -05:00
Theodore Ts'o b92ae1535c Detect if there is an attempt to run the journal twice, and
abort the e2fsck run with an error if this is the case.
(Address IBM Bugzilla bug #1226)
2003-01-02 16:53:54 -05:00
Theodore Ts'o 8161a7484f Print an error if more than one of the -p/-a, -n or -y options
are passed to e2fsck.
2003-01-02 16:36:44 -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 38513011b9 Update files for 1.32 release. 2002-11-09 15:00:56 -05:00
Theodore Ts'o 0c897a9012 Add german translation to the language catalog
Fix internationalization of "pass 2" in e2fsck.

Update po files.
2002-11-09 12:01:18 -05:00
Theodore Ts'o ae65b29f11 Update files for 1.31 release. 2002-11-08 20:08:48 -05:00
Theodore Ts'o c1637bd371 unix.c (main): Fix a bug where e2fsck could erroneously mark a
filesystem as being valid if it was being checked and it
	is interrupted with a ^C.  (Bug introduced in e2fsprogs
	1.28.)
2002-11-08 15:55:17 -05:00
Theodore Ts'o 5e72cdbeb9 unix.c (PRS), journal.c: Set the default level of journal
debugging to be 0, and allow the user to set the level of
	journal debugging by using the E2FSCK_JBD_DEBUG
	environment variable.
2002-11-08 15:35:13 -05:00
Theodore Ts'o 299d742427 Change e2fsck to force out changes to the backup copies of the
superblock and block group descriptors when important changes
are made to those data structures.
2002-11-08 11:10:28 -05:00
Theodore Ts'o ee895139d7 e2fsck.h, unix.c (main, check_mount): Fix e2fsck so that it
returns the appropriate exit code, so that the boot
	scripts will be told that they need to automatically
	reboot.
2002-11-07 16:16:55 -05:00
Theodore Ts'o 5d823a478f Update files for 1.30 release. 2002-11-01 02:13:53 -05:00
Theodore Ts'o 4fd6834c68 unix.c (usage), e2fsck.8.in: Add the -D option to the usage and
command synopsis.  (Addresses Debian bug #167108)
(missed this file in the previous checkin)
2002-10-31 19:39:03 -05:00
Theodore Ts'o b40ffd792e unix.c (usage), e2fsck.8.in: Add the -D option to the usage and
command synopsis.  (Addresses Debian bug #167108)
2002-10-31 19:30:24 -05:00
Theodore Ts'o be93ef0c14 pass1.c (e2fsck_pass1): Check the superblock write time to see
whether or not we can safely do the LOW_DTIME checks.
	(Addresses Sourceforge bug #620980)
2002-10-31 18:38:55 -05:00
Theodore Ts'o 482afc442d Makefile.in (install): Search all compression extensions when
deleting old man pages.
2002-10-31 03:32:34 -05:00
Theodore Ts'o 76dd5e5c28 Add support for the meta_bg feature flag to the resize2fs program.
Fix bug in meta_bg support in mke2fs, e2fsck, and dumpe2fs; we were 
incorrectly reserving the legacy block groups desriptor blocks.
2002-10-30 23:07:21 -05:00
Theodore Ts'o a49929b656 Add support for the meta_blockgroup filesystem format. (Missing changelog) 2002-10-20 00:58:08 -04:00
Theodore Ts'o c046ac7f2e Add support for the meta_blockgroup filesystem format. 2002-10-20 00:38:57 -04:00
Theodore Ts'o 3e69906495 Fix gcc -Wall nits.
Fix format bug if NLS is in use.

Add extra so that the info directory looks OK on OpenWall.
2002-10-13 23:56:28 -04:00
Theodore Ts'o 64aecc4dd3 Fix bug in e2fsck and mklost+found; the lost+found directory should
created with mode 0700.
2002-10-11 17:44:12 -04:00
Theodore Ts'o d237a78e4e Handle BAD_BLOCK_IN_INODE_TABLE even at the beginning of the
inode table, and shrink code by reorganizing the while loop so 
to eliminate duplicate calls to ext2fs_get_next_inode().
2002-10-03 01:09:35 -04:00
Theodore Ts'o 8132d840c8 Fix endian problems in the htree code for e2fsck and debugfs.
When byte-swapping a filesystem on a PPC architecture, byte-swap
the bitmaps since the historical big-endian ext2 variant had
byte-swapped bitmaps, and the ext2fs library assumes this.  Otherwise
the regression test suite will fail...
2002-10-02 22:07:17 -04: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 e8254bfd3b pass2.c (check_dir_block): Do a more paranoid check when trying
to determine whether or not a directory entry is a
	completely empty leaf block or leaf node.  Otherwise
	e2fsck might get confused into thinking that a valid dxdir
	was corrupted.
2002-09-29 19:30:28 -04:00
Theodore Ts'o fe5b72d15e rehash.c (e2fsck_rehash_dir): Apply patch from Christopher Li
which avoids creating an empty directory entry at the end
	of the directory block.  This screws up earlier versions
	of the indexed directory patch.
2002-09-29 19:05:26 -04:00
Theodore Ts'o e70ae99e07 Add a more sophisticated algorithm to e2fsck to salvage corrupted
directories.

Speed up e2fsck slightly by only updating the master superblock;
there is no point to update the backup superblocks.

Fix a small bug in the rehashing code which could leave the indexed
flag set even after the directory was compressed instead of indexed.
(Not fatal, since the kernel will deal with this, but technically
it filesystem isn't consistent, and the filesystem will be marked
as being in error when the kernel comes across the directory.  It
should also never happen in real life, since directories that small
will never be indexed, but better safe than sorry.)

Also change the threshold of when directories are indexed, so that
directories of size 2 blocks will be indexed.  Otherwise they will
never be indexed by the kernel when they grow.
2002-09-28 09:16:28 -04:00
Theodore Ts'o c663305947 Update for 1.29 release. 2002-09-24 01:26:50 -04:00
Theodore Ts'o cf3909edfe rehash.c (copy_dir_entries): Fix bug which caused corrupted
directories if there are 4 or 8 bytes left over in a
	directory page when optimizing/reindexing a directory.
2002-09-06 10:14:12 -04:00
Theodore Ts'o 87ee8dcad3 Update changelogs for 1.28 release 2002-08-31 03:02:57 -04:00
Theodore Ts'o b7bad61521 Update for 1.28 release. 2002-08-31 03:00:33 -04:00
Theodore Ts'o ceecbc75c3 ehandler.c (e2fsck_handle_read_error): If the user asks to
ignore the error, offer to try forcing a write of the
	block to the disk; sometimes this will cause the drive to
	remap the bad block.
2002-08-31 02:35:35 -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 f044b4d8a0 Update and clarify man pages (addresses Debian Bug #145044).
Let e2fsck allow use of the TEA hash.

Mke2fs will no longer abort if it can't zero blocks at the end of the
filesystem.  (Addresses Debian Bug #155007)
2002-08-17 13:32:21 -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
Stephen Tweedie eb16f861e9 Clear dtime field on truncated orphan inodes. 2002-08-14 11:00:44 +01:00
Theodore Ts'o 838e773e7a Change e2fsck to use a red/black tree in pass1b, to remove O(n**2)
algorithms.  Makes e2fsck much, much faster in certain rare cases
where the filesystem is severely corrupted.
2002-08-01 12:37:00 -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 542867fb70 util.c (ask_yn, read_a_char): Note when the user has typed ^C,
and abort processing by longjmp'ing to ctx->abort_loc.
2002-07-24 07:42:02 -04:00
Theodore Ts'o 3214a453db pass1.c (e2fsck_pass1): If e2fsck is run with -n, don't create
the dirs_to_hash list, since we don't want to reindex
	directories if the filesystem is opened read-only.
2002-07-23 12:00:00 -04:00
Theodore Ts'o 4cae04529e Add SIGINT and SIGTERM handling to fsck and e2fsck. For e2fsck,
make sure we gracefully clean up and only exit at safe points.
For fsck, we pass the SIGINT/SIGTERM signal to the child processes,
so they can do their own cleanup.
2002-07-21 14:14:03 -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 62acaa1de1 pass2.c (e2fsck_pass2): Use dx_dir->numblocks instead of
dx_dir->ino to indicate that a bad inode was cleared.
2002-07-15 16:54:42 -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
Andreas Dilger b21bf26778 Do sanity checking of the number of blocks and inodes in a group for
8192-byte and 16384-byte blocksize filesystems.

Change the default bytes-per-inode ratio of a new filesystem to be at most
one inode per block for large blocksizes.
2002-06-10 11:05:56 -06:00
Theodore Ts'o 0d63467ddb Update to support the V2 Bestbits EA format. 2002-05-22 00:22:38 -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 7823dd6572 Fix fencepost error in allocating space for array. 2002-05-17 23:37:42 -04:00
Theodore Ts'o 31e29a12d1 Fix up Andreas's 8k blocksize changes to fix a number of bugs,
and to make the page size determined at run-time instead of 
compile time.
2002-05-17 10:53:07 -04:00
Andreas Dilger 932a489cdf Add support for creating and checking 8192-byte blocksize filesystems.
We complain if you try to create such a filesystem on a system with 4096
byte PAGE_SIZE.

Add checks for valid inode size for undocumented -I option.
2002-05-16 03:20:07 -06:00
Theodore Ts'o a8e772498c Update for 1.27 release. 2002-03-08 03:12:14 -05:00
Theodore Ts'o 546a1ff18c Fix various gcc -Wall complaints. 2002-03-07 23:52:56 -05:00
Theodore Ts'o f2d5c93703 Fixed the journal handling so that an offer is made to clear the
journal filesystem in all cases.

Fixed a bug in e2fsck which caused it to give spurious I/O manager
bad messages right before crashes.
2002-03-07 03:13:07 -05: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 14308a5398 Newer libintl needs LC_CTYPE to be set in addition to LC_MESSAGES. 2002-03-05 03:26:52 -05:00
Theodore Ts'o 57173d0feb Update Changelog messages to use tytso@mit.edu for all addresses
after September 7, 2001.  (Forgot to update my emacs file to get
rid of the tytso@valinux.com address.  Oops.)
2002-02-26 14:59:39 -05:00
Theodore Ts'o 25813b1313 Fix typo in previous changeset; the man pages for fsck.ext2 and
fsck.ext3 should be linked to the one for e2fsck, not fsck.
2002-02-24 03:48:45 -05:00
Theodore Ts'o b9f409255e Update makefiles to install mkfs.ext3, and to install man pages for
mkfs.ext2/3 and fsck.ext2/3.  Also remove any compressed man pages
before installing the man pages.
2002-02-24 03:08:57 -05:00
Theodore Ts'o d1a2182a18 Cleaned up journal handling code in e2fsck.
Fixed up two minor memory leaks.
2002-02-22 00:17:59 -05:00
Theodore Ts'o a5f3f5c191 Update files for 1.26 release. 2002-02-03 01:00:22 -05:00
Theodore Ts'o 96b5cacc04 Miscellaneous cleanup before 1.26-WIP release. Removed unused
.cvsignore in include/asm directory so it can disappear.  Updated
makefile dependencies, and stop including <topsrc>/include in the
-I search path, since it's no longer needed.
2001-12-24 15:33:49 -05:00
Theodore Ts'o 3ed57c27df In mke2fs and e2fsck, specifying the -c option twice will now do
a read/write test on the disk.  Update the man pages to encourage
using the -c option, and to discouraging running badblocks separately,
since users tend to forget to set the blocksize when running 
badblocks.
2001-12-24 15:01:59 -05:00
Theodore Ts'o fae9bfaa5c Initialize buf to NULL to avoid crashing when called by fix_problem() 2001-12-23 22:56:12 -05:00
Theodore Ts'o f1a1761d67 Enhnaced the get backup superblock function so that it does
the right thing if the filesystem superblock is unavailable; 
it will search for the superblock by iterating over possible
blocksizes.
2001-12-23 22:27:52 -05:00
Theodore Ts'o 19007e51a5 Move linux/jbd.h to ext2fs/kernel-jbd.h, to avoid using the
system header file version of hbd.h when using diet glibc
(since it forcibly adds /usr/include to the beginning of include
search path.)
2001-12-23 19:33:51 -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 4ea7bd0439 Fix various gcc -Wall nits. Fixed a bug in mke2fs where a bogus
error message could be printed on an malloc() failure, and e2image
was optimized to avoid needless system calls by using the stashed
inode functions.
2001-12-16 23:23:37 -05:00
Theodore Ts'o 8cf93332d1 Fix e2fsck's handling of external journals,and update journal
recovery files from 2.4.17-pre8.
2001-12-16 02:23:36 -05:00
Theodore Ts'o 571fc5a89c Fixes necessary for e2fsprogs to work using the diet libc.
- Renamed linux/list.h to be linux/linked_list.h to work around a
  problem caused by diet libc insistence to search the kernel
  header files ahead of all other files in the include path, 
  including the user specified include files.

- Worked around a bug in diet libc which core dumps when using 
  putc with stderr by using fputs instead.  As a bonus, this
  also shaved a few bytes off of com_err.o.

- Fixed a real bug in debugfs which was detected because diet libc
  was more sensitive than glibc when incorrectly using fclose()
  where pclose() is required.
2001-12-02 17:23:27 +01:00
Gabriel Paubert b3b3d465b1 journal.c: fix an endianness bug.
f_badorphan: revert previous, erroneous change.
2001-11-30 13:45:28 +01:00
Theodore Ts'o 24bfb443fc super.c (check_super_block): Make sure that if the inode table
or allocation bitmap is zero, that it is marked as
	invalid, so that in pass #1, a new bitmap/inode table gets
	properly allocated.  (Addresses Debian Bug #116975)
2001-11-26 15:51:14 -05:00
Theodore Ts'o 1e9a7e0278 2fsck.8.in: Fix minor typo in man page and clarify device
specification.
2001-11-24 16:40:57 -05:00
Andreas Dilger 6a138ed42a Allow a single user for internal journals (the current filesystem)
since this is how the filesystem is created.
2001-11-08 17:50:50 -07: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 fbf9111216 Update changelogs for 1.25 release. 2001-09-20 10:47:47 -04:00
Theodore Ts'o ae6cdcf74a e2fsck: If a superblock is specified explicitly by the
user, don't try to automatically fall back to an
	alternate superblock.
2001-09-19 15:17:25 -04:00
Theodore Ts'o fb70775b0f Update for 1.24a release 2001-09-04 15:00:37 -04:00
Theodore Ts'o 109624a133 Update for 1.24 release. 2001-08-31 00:59:55 -04:00
Andreas Dilger 59f27247f8 mke2fs.c (main): Zap the second sector of the disk, along with
any sectors in the same filesystem block after the superblock.
        The latter will remove (for example) swapspace signatures
        on 4kB+ blocksize filesystems.  Also when zeroing the "end"
        of the filesystem don't actually zero the start of a very
        small device (less than 128kB).
2001-08-30 15:39:04 -06:00
Theodore Ts'o b1f204f7f9 pass1.c (e2fsck_pass1): For EXT2_RESIZE_INO, allow its i_mode to
either be zero or a regular file (for compatibility with
	Andreas's on-line resizing programs).
2001-08-30 16:42:09 -04:00
Theodore Ts'o 0f8973fb09 Remove EXT2FS_VERSION from the version display, since it
only confuses people.

Make fsck's version display be consistent with the other e2fsprogs
programs.
2001-08-27 12:44:23 -04:00
Theodore Ts'o 943ed874fc Add missing log entry showing when we released e2fsprogs 1.23 2001-08-27 12:29:22 -04:00
Theodore Ts'o 53abed0afa Deal with libc5's lack of strnlen.
Stop checking for strdup in the configure script since we don't 
care about that symbol.
2001-08-27 12:18:16 -04:00
Theodore Ts'o eb4ab51044 super.c (release_orphan_inodes): If the filesystem contains
errors, don't run the orphan * list, since the orphan list
	can't be trusted.
2001-08-13 10:58:41 -04:00
Theodore Ts'o a40ecbb1fc e2fsck/pass1.c (e2fsck_pass1_check_device_inode): If i_blocks is
non-zero, then assume that the device/socket/fifo inode
	is bogus.
2001-08-13 06:15:36 -04:00
Theodore Ts'o 85645a6ff3 pass1.c (check_size): Fix logic in check_size; the previous code
only offered to clear the inode size fields if both size
	and i_size_high were zero.
2001-08-13 06:11:39 -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
Theodore Ts'o 2b94c658c7 unix.c (show_stats): Print the number of large files in verbose mode. 2001-08-09 04:08:52 -04:00
Theodore Ts'o e3bda78302 Add dependencies to iscan. 2001-08-08 20:50:57 -04:00
Theodore Ts'o d4cac023c2 Add missing errcode_t variable so that iscan compiles. 2001-08-08 16:10:23 -04:00
Theodore Ts'o c0a083fac3 * journal.c (recover_ext3_journal): If s_errno is set in the
journal superblock, set the EXT2_ERROR_FS flag in the
	filesystem superblock after the journal is run.
2001-08-07 10:17:41 -04:00
Theodore Ts'o bd512b6868 Add ChangeLog entry for changes made by Andreas 2001-08-04 21:33:03 -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 83e6ac84c7 unix.c (check_mount): Remove the code in e2fsck which tested for the
root filesystem being mounted read-only, and depend on the
	results flags from ext2fs_check_if_mounted.
2001-07-30 16:29:52 -04:00
Theodore Ts'o 0628ae3948 unix.c (main): Move the final print_resource_track call after
the filesystem and context handle are closed
2001-07-29 12:26:46 -04:00
Theodore Ts'o 6d222f3217 Fix memory leaks in e2fsck's journal.c, and remove some cases
which look like memory leaks in unix.c so we can more easily find
the true memory leaks.
2001-07-29 12:06:58 -04:00
Theodore Ts'o 1e16526bd9 e2fsck.c (e2fsck_reset_context): Fix bug; only close the io channel if
it is *different* from the filesystem io channel
2001-07-29 11:48:10 -04: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 fd77b2c78a pass1.c (e2fsck_pass1): Check for symlinks that have the
immutable flag set (and offer to clear them).
2001-07-27 22:10:01 -04:00
Theodore Ts'o 24ceb248ab pass1.c (e2fsck_pass1): Free ctx->block_ea_map at the end of pass 1.
This avoids increasing the memory footprint of e2fsck by 10%!
2001-07-26 09:02:56 -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 d312401961 unix.c (main): Add an explicit warning when the filesystem is left not
completely fixed when e2fsck exits.  (Addresses Debian bug #104502.)
2001-07-20 14:13: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 0f2cfe2579 Fix really stupid typo. 2001-07-10 14:34:41 -04:00
Theodore Ts'o 3c6b8977d4 Speed up journal recovery in userspace by avoiding a pointless
unconditional ext2_flush() call.  Also made ext2_flush() more
efficient when the superblock is modified after the filesystem has
been flushed, and make it clear the superblock dirty flag
after doing the superblock/block group descriptor flush.
2001-07-10 14:27:58 -04:00
Theodore Ts'o 7b63fff9b6 pass1b.c (pass1b, process_pass1b_block): Change the num_bad
field calculation so that it only counts EA block entries
	as a single multiply claimed block (since once we clone
	the EA blocks for one inode, we fix the problem for all of
	the other inodes).  Also, I moved the num_bad calculation
	from process_pass1b_block to the end of pass1b.  This
	fixes a *significant* performance bug in pass1b which hit
	people who had to had a lot of multiply claimed blocks.
	(Can you say O(n**3) boys and girls?  I knew you could...
	Fortunately, this case didn't happen that much in actual practice.)
2001-07-07 23:01:31 -04:00
Theodore Ts'o b5acdb6ae2 pass1.c (e2fsck_pass1): Defer inodes which have an extended attribute
block for later processing to avoid extra seeks across the disk.
	(process_inode_cmp): If there is no indirect block, sort by the
	extended attribute (i_file_acl) block.
2001-07-07 22:27:40 -04:00
Theodore Ts'o 7abb2bdcd6 pass1b.c (clone_file_block): Fix bugs when cloning extended attribute
blocks.  Moved free of block_buf to after the code which clones the
	extattr block, and fixed logic for changing pointers to the extended
	attribute field in the inodes which were affected.
 
(decrement_badcount): New function which is used whenever we need to
	decrement the number of files which claim a particular bad block.
	Fixed bug where delete_file wasn't checking check_if_fs_block() before
	clearing the entry in block_dup_map.  This could cause a block which
	was claimed by multiple files as well as the filesystem metadata to
	not be completely fixed.
2001-07-07 13:20:34 -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 636a954a30 Use long long to calculate the percentage
of the number of blocks in use in the filesystem.
2001-06-29 17:57:26 -04:00
Theodore Ts'o 67960139d7 Update changelogs for 1.22. 2001-06-23 00:16:37 -04:00
Theodore Ts'o d90f3494b2 e2fsck/flushb.c and lib/ext2fs/flushb.c: Use platform independent
method of defining the BLKFLSBUF and FDFLUSH ioctl's.
	Also include sys/mount.h since on newer glibc's BLKFLSBUF
	is defined there.
2001-06-22 21:01:17 -04:00