Commit Graph

43 Commits (master)

Author SHA1 Message Date
Theodore Ts'o 5eca88c1dc debugfs: fix logdump to work on files > 2GB
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-12 21:42:47 -04:00
Darrick J. Wong 4ee2669982 debugfs: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-10-24 01:26:35 -04:00
Theodore Ts'o df0b907ec1 debugfs: cleanup gcc -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-13 16:00:12 -04:00
Theodore Ts'o 9603da15cb Revert "debugfs: add the hexdump_block command"
This reverts commit 58b0356a25.

We already have the block_dump (bd) command, but I had completely
forgotten about it.  Oops!

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-06-21 20:14:32 -04:00
Theodore Ts'o 58b0356a25 debugfs: add the hexdump_block command
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-06-20 00:10:20 -04:00
Darrick J. Wong 38d5adf339 e2fsck/debugfs: fix descriptor block size handling errors with journal_csum
It turns out that there are some serious problems with the on-disk
format of journal checksum v2.  The foremost is that the function to
calculate descriptor tag size returns sizes that are too big.  This
causes alignment issues on some architectures and is compounded by the
fact that some parts of jbd2 use the structure size (incorrectly) to
determine the presence of a 64bit journal instead of checking the
feature flags.  These errors regrettably lead to the journal
corruption reported by Mr. Reardon.

Therefore, introduce journal checksum v3, which enlarges the
descriptor block tag format to allow for full 32-bit checksums of
journal blocks, fix the journal tag function to return the correct
sizes, and fix the jbd2 recovery code to use feature flags to
determine 64bitness.

Add a few function helpers so we don't have to open-code quite so
many pieces.

Switching to a 16-byte block size was found to increase journal size
overhead by a maximum of 0.1%, to convert a 32-bit journal with no
checksumming to a 32-bit journal with checksum v3 enabled.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reported-by: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:40:54 -04:00
Darrick J. Wong 46272d5aa2 debugfs: force logdump to display (old) journal contents
If the user passes the -O option to logdump, try to dump old log
contents.  This can be used to try to track down journal problems even
after the journal has been replayed.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-05-11 23:28:57 -04:00
Darrick J. Wong a1ff15f83b debugfs: teach logdump to deal with 64bit revoke tables
The logdump command doesn't know how to deal with revoke tables in
64bit journals, so teach it to do this.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-05-11 21:04:17 -04:00
Theodore Ts'o d2dce124dd Merge branch 'maint' into next
Conflicts:
	debian/changelog
	e2fsck/Makefile.in
2014-01-06 06:58:58 -05:00
Theodore Ts'o b34b94d5cd debugfs: clean up read_journal_block() to avoid Coverity complaint
The read_journal_block() function was needlessly complicated, which
made it harder to read/maintain, and it also tripped up Coverity.
Cleaning it up also avoided some signed/unsigned casts, and allows us
to avoid passing got back to the caller, since it wasn't needed.

Addresses-Coverity-Bug: #709539

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-01-04 19:11:37 -05:00
Theodore Ts'o 2ffccc82c4 Merge branch 'maint' into next
Conflicts:
	lib/ext2fs/csum.c
2013-12-26 00:30:56 -05:00
Theodore Ts'o f404167dda Clean up sparse warnings
Mostly by adding static and removing excess extern qualifiers.  Also
convert a few remaining non-ANSI function declarations to ANSI.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-16 18:56:36 -05:00
Theodore Ts'o e337e7fad8 Merge branch 'maint' into next
Conflicts:
	e2fsck/problem.c
	e2fsck/rehash.c
	e2fsck/super.c
2013-10-12 22:26:28 -04:00
Darrick J. Wong 4dbfd79d14 e2fsprogs: fix blk_t <- blk64_t assignment mismatches
Fix all the places where we should be using a blk64_t instead of a
blk_t.  These fixes are more severe because 64bit values could be
truncated silently.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-10-07 09:51:48 -04:00
Darrick J. Wong 2556373a33 libext2fs: change on-disk journal layout to support metadata checksumming
Define flags and change journal structure definitions to support v2 journal
checksumming.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-08-02 20:47:45 -04:00
Theodore Ts'o d1154eb460 Shorten compile commands run by the build system
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn.  It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18 17:34:37 -04:00
Andreas Dilger 931b58e1cb ext2fs: Handle internal journal over 2^32 bytes
The write_journal_inode() code is only setting the low 32-bit i_size
for the journal size, even though it is possible to specify a journal
up to 10M blocks in size.  Trying to create a journal larger than 2GB
will succeed, but an immediate e2fsck would fail.  Store i_size_high
for the journal inode when creating it, and load it upon access.

Use s_jnl_blocks[15] to store the journal i_size_high backup.  This
field is currently unused, as EXT2_N_BLOCKS is 15, so it is using
s_jnl_blocks[0..14], and i_size is in s_jnl_blocks[16].

Rename the "size" argument "num_blocks" for the journal creation functions
to clarify this parameter is in units of filesystem blocks and not bytes.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-06-11 12:17:29 -04:00
Theodore Ts'o c5b23f6c0e Merge branch 'maint' into next 2010-03-15 18:53:45 -04:00
Theodore Ts'o de2c477815 debugfs: Correctly show the allocation status of a block using logdump
The offset in the bitmap was not getting correctly calculated when the
user specifics a block to track using "logdump -b <block-num>"

Addresses-Debian-Bug: #564084

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-03-15 00:14:12 -04:00
Valerie Aurora Henson 048786d7e8 debugfs: Convert to support 64-bit filesystems
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 22:46:17 -04:00
Valerie Aurora Henson 4efbac6fed Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 20:46:34 -04:00
Eric Sandeen dad0bab204 debugfs: don't try to fclose NULL
do_logdump may jump to errout if fopen(out_file) fails,
but in that case out_file is NULL, and fclose will segfault.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-06-29 01:07:29 -04:00
Manish Katiyar a5bde7959b debugfs: Fix typos in logdump's error messages
Below patch fixes some trivial typos found during code reading

Signed-off-by : Manish Katiyar <mkatiyar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-03-08 20:48:36 -04:00
Theodore Ts'o 98446d7382 debugfs: Fix logdump command for 32-bit filesystems
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-01-18 22:48:16 -05:00
Manish Katiyar c59776306c debugfs: Make the usage messsage of logdump consistent with man page
Signed-off-by: Manish Katiyar <mkatiyar@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-10-01 19:55:10 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o 2d328bb76d Fix miscellaneous gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-17 23:17:13 -04:00
Valerie Clement 5d38ef1d04 libext2fs: cleanup usage of unsigned int or __u32 and replace it with blk_t
Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-10-14 21:54:28 -04:00
Theodore Ts'o 2eae093081 Clean up applications to not use EXT2FS_ENABLE_SWAPFS or EXT2_FLAG_SWAP_BYTES
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-11 02:57:31 -04:00
Brian Behlendorf 0bed54fd3e [COVERITY] Fix file handle leak in debugfs's logdump (in error case)
Also fixed a bug in checking if the fopen failed.

Coverity ID: 30: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-23 23:01:09 -04:00
Theodore Ts'o 9b9a780f5a Fix various gcc -Wall complaints.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-10 21:50:30 -05:00
Theodore Ts'o 544349270e Fix gcc -Wall nitpicks 2003-12-07 01:28:50 -05: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 88494bb6d4 util.c, ls.c, logdump.c, htree.c, dump.c, debugfs.h, debugfs.c, ChangeLog:
util.c (reset_getopt), debugfs.c (do_open_filesys,
  	do_show_super_stats), ls.c (do_list_dir), dump.c (do_dump),
  	htree.c (do_htree_dump, do_dx_hash), logdump.c (do_logdump):
  	Define and use a new function, reset_getopt(), which does whatever
  	is necessary to reset getopt() again.  This is different for
  	different implementations, so the portabilty issues are a bit of a
  	nightmare.  (Addresses Debian bug #192834)
2003-05-13 23:03:43 -04:00
Theodore Ts'o ed78c021c3 Fix up lots of portability problems that caused e2fsprogs not to build successfully
under Solaris.
2003-03-06 11:09:18 -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 e1018eeaa3 Add new debugfs commands and arguments which make it easier to
recover deleted files.  The lsdel command now takes an optional
argument which allows the user to only see the most recently
deleted files.  Also added a new command, undel, which automates
undeleting a deleted inode and linking it back to a directory.
Also added an optional count argument to the testb, freeb, setb,
and find_free_block commands.  The ls command now takes a new
option, -d, which lists deleted directory entries.

Factored out out commonly used code into utility subroutines
for ease of maintenance and to make the executable size smaller.
2002-01-03 04:55:25 -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
Stephen Tweedie ff63f2686f Fix debugfs/logdump.c to compile with configure --disable-swapfs. 2001-09-27 15:48:56 +01:00
Theodore Ts'o 5faba3acba logdump.c (do_logdump, dump_journal): Add support for dumping
external journals.
2001-08-12 03:38:51 -04:00
Theodore Ts'o 5e4f070952 ChangeLog, debugfs.c, debugfs.h, logdump.c:
debugfs.c, debugfs.h, logdump.c: Fix various gcc -Wall nitpicks.
2001-06-01 15:36:05 +00:00
Theodore Ts'o 4bb0c0434c ChangeLog, logdump.c:
logdump.c (read_journal_block): Replace pread with lseek/read combination.
2001-06-01 15:22:38 +00:00
Theodore Ts'o da81e3fcfe Many files:
debugfs.c (dump_blocks, dump_inode, internal_dump_inode): Add
  	internal_dump_inode() interface for the logdump command.
  logdump.c: Imported code from Stephen Tweedie to dump the ext3 journal.
2001-03-29 20:49:58 +00:00