Commit Graph

4986 Commits (463eb92131d9bab6ca48820a1bd47352117db360)

Author SHA1 Message Date
Darrick J. Wong 463eb92131 debugfs: add the ability to write transactions to the journal
Extend debugfs with the ability to create transactions and replay the
journal.  This will eventually be used to test kernel recovery and
metadata_csum recovery.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 16:52:37 -04:00
Darrick J. Wong dad8fc5fff e2fsck: fix minor errors in journal handling
The journal superblock's s_sequence field seems to track the tid of
the tail (oldest) transaction in the log.  Therefore, when we release
the journal, set the s_sequence to the tail_sequence, because setting
it to the transaction_sequence means that we're setting the tid to
that of the head of the log.  Granted, for replay these two are
usually the same (and s_start == 0 anyway) so thus far we've gotten
lucky and nobody noticed.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 16:45:42 -04:00
Darrick J. Wong 759c46cf45 debugfs: create journal handling routines
Create a journal.c with routines adapted from e2fsck/journal.c to
handle opening and closing the journal, and setting up the
descriptors, and all that.  Unlike e2fsck's versions which try to
identify and fix problems, the routines here have no way to repair
anything.

[ Modified by tytso to fold debugfs/jfs_user.h into e2fsck/jfs_user.h,
  so we don't have to copy recovery.c and revoke.c into debugfs. --tytso ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 16:44:10 -04:00
Darrick J. Wong e690eae513 misc: zero s_jnl_blocks when removing internal journal
When we're removing the internal journal (broken journal, turning it
off, or adding an external journal), zero s_jnl_blocks so that they
can't be picked up by accident later.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:40:55 -04:00
Darrick J. Wong 3727a0e745 dumpe2fs: display external journal feature flags
Display the feature flags of an external journal.

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:55 -04:00
Darrick J. Wong 811bccef89 tune2fs: explicitly disallow tuning of journal devices
Spit out a more specific error if someone tries to modify an
external journal device.

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:55 -04:00
Darrick J. Wong 6aabb75493 e2fsck: detect and repair external journal superblock checksum errors
Verify the (ext4) superblock checksum of an external journal device
and prompt to correct the checksum if nothing else is wrong with the
superblock.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:40:55 -04:00
Darrick J. Wong 7a8f497356 mke2fs: allow creation of journal device with superblock checksum
Enable mke2fs to create an external journal device with a superblock
checksum.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:40:55 -04:00
Darrick J. Wong fc06f25a10 libext2fs: write_journal_inode should check iterate return value
When creating a journal inode, check the return value from
block_iterate3() because otherwise we fail to capture errors such as
being unable to allocate an extent tree block, which leads to e2fsck
creating broken journals.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:40:54 -04:00
Darrick J. Wong 4f769f4c03 misc: don't return ENOMEM if we run out of disk space
If there aren't enough blocks in the FS to allocate all of the
hugefiles, return ENOSPC, not ENOMEM.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:40:54 -04:00
Darrick J. Wong f92c600c09 libext2fs: report bad magic over bad sb checksum
We don't want ext2fs_open2() to report bad sb checksum on something
that's not even an ext* superblock.  This apparently happens pretty
easily if we try to open an XFS filesystem.  Thus, make it so that a
bad magic number code always trumps the sb checksum error code.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:40:54 -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
Theodore Ts'o 330cebc0e9 Merge branch 'maint' into next
Conflicts:
	debugfs/debugfs.c
	e2fsck/Makefile.in
	lib/ext2fs/Makefile.in
	tests/test_config
2014-09-11 12:40:43 -04:00
Theodore Ts'o e426e06afa Merge remote-tracking branch 'origin/maint' into maint 2014-09-11 12:26:27 -04:00
Theodore Ts'o e9a5c6e360 e2fsck: notice when the realloc of dir_info fails
If the reallocation of dir_info fails, we will eventually cause e2fsck
to fail with an internal error.  So if the realloc fails, print a
message and bail out with a fatal error early when at the time of the
reallocation failure.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-11 12:24:07 -04:00
Michael Forney 943e21cda8 compile_et: Allow user to override ET_DIR
Signed-off-by: Michael Forney <forney@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-08 19:02:12 -04:00
Michael Forney 53904ae543 Apply LDFLAGS when building tests
Signed-off-by: Michael Forney <forney@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-08 19:00:24 -04:00
Michael Forney 60abcd7394 tests: Add to LD_LIBRARY_PATH instead of overriding
Signed-off-by: Michael Forney <forney@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-09-08 18:55:42 -04:00
Theodore Ts'o 8a54677711 debugfs: add better error checking when printing extended attributes
Check to make sure the length of the name and value fields in the
extended attribute don't result in overrun the bounds of the inode.

Addresses-Coverity-Bug: #709517

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 14:20:21 -04:00
Theodore Ts'o b874d24629 v1.42.12
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJUAIPFAAoJENNvdpvBGATwoZ8P/AxCEVC90Cj+lz8ayEJ/v0RB
 Q61qScNMuzgzPLA6xfFUQqnnAzLFIvhlLazGbOJFDDrIc9Ek4HZZqTldsJTK+B3l
 V5X+o66E1U9+gL64qBKuJz+anS09jGLLrKvH1Ok+vMtD35xPxkrPa0Egrw5/q2gD
 3YXxvQHSuTGx3qHwTJ6MNpBM2O7DSNRV3lARLRY3rkIkRUPPBLPiqYaL2tTE7Er1
 9I5ENKURrHu4uZ3b0OLD3SGhdesLWsguzMzrep0vOZ7PSfmLSZiiURA3puyHj2hl
 Ixxk+qFqv9mUq86rUo+we9N0qU4dKbfdOxMCbY7DyGJdoDzDQany3zw5EG/XO+Ws
 MKJ1qUm30l32FrqkFkFwL0PWzCssV86lfwsIt4f3My3v61C91B9YbxMR2magzmB5
 B1yTCyEWu4hgPld98fgq1cVVpeWtxCejG7llg4gsDbRwJYlv+hSVVBBPmEofr4F7
 j2GdRm5KXKIBETx1WWqLeTHhDrD68rpU8RISrCPOYUBmFdyNA3H38ret23GvF6BT
 Im/xlxhAWL/EzBEYA6OyvckWA2VUvYH3jEoSZwtgpxeSIFP0ABInPrmsTLHY2kdI
 cx9VWV9+0GdVUc/ObSud4FHYcdc7IyGaKZp0M2YlYTQTqDIBZDiy1liyHYQ4/rvb
 20I2th2DbtdTpMiPlHgJ
 =igQE
 -----END PGP SIGNATURE-----

Merge tag 'v1.42.12' into next

v1.42.12

Conflicts:
	version.h
2014-08-29 11:38:33 -04:00
Theodore Ts'o 6a3741ad29 Update release notes, etc. for final 1.42.12 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 09:00:51 -04:00
Trần Ngọc Quân 6de37becb0 po: update vi.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 08:46:03 -04:00
Yuri Chornoivan 817844071c po: update uk.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 08:46:03 -04:00
Göran Uddeborg 90c5f7ca4e po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 08:46:03 -04:00
Jakub Bogusz 5b5fc7f6ad po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 08:46:03 -04:00
Benno Schulenberg 8e3bfde840 po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 08:46:03 -04:00
Samuel Thibault 482a0eabf9 po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 08:46:02 -04:00
Petr Pisar a20457477a po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-29 08:46:02 -04:00
Theodore Ts'o 725502de19 mke2fs: complain if bigalloc and hugefiles_align_disk is incompatible
If the starting partition offset is incompatible with the bigalloc
cluster size, complain and exit, instead of creating a file which
would have a logical to physical block mapping which breaks the
cluster alignment requirement.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-27 09:27:54 -04:00
Darrick J. Wong bf93a9685e e2fsck: fix infinite loop when recovering corrupt journal blocks
When recovering the journal, don't fall into an infinite loop if we
encounter a corrupt journal block.  Instead, just skip the block and
proceed with the full filesystem fsck.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-26 23:45:11 -04:00
Darrick J. Wong 97f168b67e e2fsck: resync jbd2 revoke code from Linux 3.16
Synchronize e2fsck's copy of revoke.c with the kernel's copy in
fs/jbd2.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-26 23:43:20 -04:00
Darrick J. Wong 13af4b93fb e2fsck: resync jbd2 recovery code from Linux 3.16
Synchronize e2fsck's copy of recovery.c with the kernel's copy in
fs/jbd2.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-26 23:32:14 -04:00
Darrick J. Wong 389931ca1f contrib: add script to help resync journal code with kernel
Add a script that handles (most) of the code massaging necessary to resync
{recovery,revoke}.c from the Linux kernel into e2fsprogs.

Usage: jbd2-resync.sh linux/fs/jbd2/revoke.c e2fsprogs/e2fsck/revoke.c

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-26 23:32:05 -04:00
Theodore Ts'o 3ff57555f6 e2fsprogs.pot: update POT-Creation-Date
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-26 16:34:24 -04:00
Theodore Ts'o a4af7efe54 e2fsck: fix spelling error (strage vs storage)
Reported-by: Philipp Thomas <pth@suse.de>

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-26 09:42:18 -04:00
Eric Sandeen e92beaac10 e2fsprogs: add supported file attributes to ext4.5 manpage
The chattr(1) manpage now refers users to filesystem-specific
manpages for details on supported attributes, so add those to
ext4.5.

I've left out oddities like being able to set the compressed
or no-tail-packing flags, or setting data journaling on ext2.

That behavior seems like a bug, not a feature.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-25 21:02:18 -04:00
Theodore Ts'o c1c8800b71 Merge branch 'maint' into next
Conflicts:
	RELEASE-NOTES
	debian/changelog
	version.h
2014-08-25 18:37:37 -04:00
Theodore Ts'o d9eab8e2f0 tests/d_inline_dump: remove version dependency in the expected output
Also add the convenience macro $CLEAN_OUTPUT in test_config which can
be used to run the "sed -e $cmd_dir/filter.sed" command to clean up
e2fsprogs command output before comparing with the expected golden
output.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-25 18:04:42 -04:00
Theodore Ts'o 6b319481d9 Interim updates of release notes, etc. in preparation for 1.42.12 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-25 10:30:53 -04:00
Göran Uddeborg a8193af3b2 po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-25 10:05:34 -04:00
Samuel Thibault 4338f0a781 po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-25 10:05:34 -04:00
Antonio Ceballos 6c3c7829b3 po: update es.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-25 10:05:34 -04:00
Petr Pisar 5819e585a8 po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-25 10:05:34 -04:00
Theodore Ts'o ce2e295d7b mke2fs: improve the error message when a non-existent file is specified
If the user does not specify the file system size, and the file does
not exist, give an error message like this:

   The file /tmp/foo.img does not exist and no size was specified.

instead of this:

    Creating regular file /tmp/foo.img
    mke2fs: Device size reported to be zero.  Invalid partition specified, or
	    partition table wasn't reread after running fdisk, due to
	    a modified partition being busy and in use.  You may need to reboot
	    to re-read your partition table.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-24 23:54:37 -04:00
Theodore Ts'o 9ac2930cc9 mke2fs.8.in: explain how the fs-size parameter is interpreted
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-24 23:53:33 -04:00
Theodore Ts'o 77255cf369 resize2fs: clarify the size of blocks in resize2fs's messages
Addresses-Debian-Bug: #758029

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-24 23:23:41 -04:00
Theodore Ts'o 061c566eaa resize2fs.8.in: clarify when on-line resizing is supported
Addresses-Debian-Bug: #726760

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-24 22:40:43 -04:00
Theodore Ts'o 20d6b381a1 dumpe2fs: complain if extra arguments are given on the command line
Addresses-Debian-Bug: #758074

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-24 22:31:03 -04:00
Darrick J. Wong 4348709c5c e2fsck: on BE, re-swap everything after a damaged dirent so salvage works correctly
On big-endian systems, if the dirent swap routine finds a rec_len that
it doesn't like, it continues processing the block as if rec_len == 8.
This means that the name field gets byte swapped, which means that
salvage will not detect the correct name length (unless the name has a
length that's an exact multiple of four bytes), and it'll discard the
entry (unnecessarily) and the rest of the dirent block.  Therefore,
swap the rest of the block back to disk order, run salvage, and
re-swap anything after the salvaged dirent.

The test case for this is f_inlinedata_repair if you run it on a BE
system.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-24 22:02:49 -04:00
Darrick J. Wong 2432a41a58 libext2fs: fix problems with LE<->BE conversions on BE platforms
Fix more problems that I found when testing on ppc64:

- Inode swap cut and paste error leads to immutable inodes being
  detected as inlinedata inodes, leading to e2fsck incorrectly barfing
  on i_block[] contents.

- Superblock csum/verify must be aware of the fs->super byte order
  when checking for metadata_csum feature flag.  (Hint: in _openfs(),
  fs->super is in LE order for the first csum verification)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-24 22:01:36 -04:00