Whamcloud - gitweb
tools/e2fsprogs.git
12 years agoLU-1540 e2fsck: add missing symlink NUL terminator v1.42.7.wc1
Andreas Dilger [Sat, 14 Jul 2012 02:33:01 +0000 (20:33 -0600)]
LU-1540 e2fsck: add missing symlink NUL terminator

If a long symbolic link target is written into an external block
without a NUL terminator, its length is decided by the inode's size.
Make symlink check add a NUL termination in such cases if needed.

Such faulty symlinks were generated by osd-ldiskfs on the MDS until
Lustre 2.1.3 and Lustre 2.3.  The in-kernel code would handle such
unterminated symlinks correctly, since it used the inode size to
determine the symlink length, but e2fsck would assume the symlink
is broken if there wasn't a trailing NUL.

  LU-2627 e2fsck: check_symlink() SIGSEGV

  Since e2fsck_pass1_check_symlink() calls into check_symlink()
  with pctx == NULL, we should use 'ino' instead of 'pctx->ino'
  in check_symlink().

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
  Change-Id: If9c16f96d0655d5a886ef607f1f47ced6176f8d8

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I4419b30f1adb4a7d273796a936427aa351510213

12 years agoLU-1502 quota: Add basic tests for quota
Niu Yawei [Tue, 12 Jun 2012 08:37:13 +0000 (01:37 -0700)]
LU-1502 quota: Add basic tests for quota

Fixed two minor defects in the quota code, added basic tests for
the quota feature.

Note that the m_quota test is *FAILING* on some systems, but the same
test is passing on other systems (in particular the build/test nodes):

  @@ -24,7 +24,7 @@ Pass 2: Checking directory structure
   Pass 3: Checking directory connectivity
   Pass 4: Checking reference counts
   Pass 5: Checking group summary information
  -test_filesys: 11/32768 files (18.2% non-contiguous), 5703/131072 blocks
  +test_filesys: 11/32768 files (18.2% non-contiguous), 5709/131072 blocks
   Exit status is 0

   Filesystem volume name:   <none>
  @@ -39,7 +39,7 @@ Filesystem OS type:       Linux
   Inode count:              32768
   Block count:              131072
   Reserved block count:     6553
  -Free blocks:              125369
  +Free blocks:              125363
   Free inodes:              32757
   First block:              1
   Block size:               1024
  @@ -65,8 +65,8 @@ Group 0: (Blocks 1-8192)
     Reserved GDT blocks at 3-258
     Block bitmap at 259 (+258), Inode bitmap at 260 (+259)
     Inode table at 261-516 (+260)
  -  7650 free blocks, 2037 free inodes, 2 directories
  -  Free blocks: 543-8192
  +  7644 free blocks, 2037 free inodes, 2 directories
  +  Free blocks: 549-8192
     Free inodes: 12-2048
   Group 1: (Blocks 8193-16384)
     Backup superblock at 8193, Group descriptors at 8194-8194

I'm leaving this in the "passing-on-build nodes" state, even though it
is failing on my local system, so that at least we can build and test
packages.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: If3d68075aa89d6abf0cf77be93ee3b7d927ed545

12 years agoLU-1502 build: enable quota when building
Niu Yawei [Mon, 11 Jun 2012 13:33:55 +0000 (06:33 -0700)]
LU-1502 build: enable quota when building

The quota support is disabled by default, but we need to enable it
explicitly when build e2fsprogs for Lustre 2.4.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ic09f7c100b254559a5223460242b3bf465ff0802

12 years agotests: add basic test case for e2scan
Andreas Dilger [Fri, 13 Apr 2012 19:24:30 +0000 (13:24 -0600)]
tests: add basic test case for e2scan

Add a simple test to verify that e2scan is detecting the correct
files in the filesystem based on the modification time.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2scan: a tool for fast namespace/inode scanning
Andreas Dilger [Fri, 13 Apr 2012 19:17:37 +0000 (13:17 -0600)]
e2scan: a tool for fast namespace/inode scanning

e2scan is a tool for efficiently scanning inodes for changes,
or all inodes, and then generating pathnames for the inodes
of interest.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoext2fs: add readahead method to improve scanning
Andreas Dilger [Fri, 13 Apr 2012 18:58:53 +0000 (12:58 -0600)]
ext2fs: add readahead method to improve scanning

Add a readahead method for prefetching ranges of disk blocks.
This is useful for inode table scanning, and other large
contiguous ranges of blocks, and may also prove useful for
random block prefetch, since it will allow reordering of the
IO without waiting synchronously for the reads to complete.

It is currently using the posix_fadvise(POSIX_FADV_WILLNEED)
interface, as this proved most efficient during our testing

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: add Lustre lfsck tool
Andreas Dilger [Fri, 13 Apr 2012 08:32:19 +0000 (02:32 -0600)]
e2fsck: add Lustre lfsck tool

The lfsck tool, in conjunction with e2fsck, build a DB4 database
of all the inodes and objects on the MDT and OST filesystems.

The lfsck tool combines the databases on the Lustre client,
and can verify that all of the objects referenced by inodes
exist, are not referenced by two inodes, and have a parent
inode.

  LU-266 e2fsck: regenerate LAST_ID file

  e2fsck should be able to regenerate the LAST_ID file if it gets
  corrupted.  This patch will create a new LAST_ID file if it was
  deleted, and removes the unnecessary lfsck_get_last_id function.
  The last_id is then set as before in e2fsck_pass6_ost to be either
  the max objid on disk, or the MDS' max ost id, whichever is larger.

Reported-by: Bernd Schubert <aakef@fastmail.fm>
Signed-off-by: Kit Westneat <kwestneat@ddn.com>
  Change-Id: Ic5396da000909b826b76da2fd5a0b5ce88b06944

  LU-2682 lfsck: fix access to ost_id structures

  Changes in upstream lov_mds_md use lmm_oi and l_ost_oi instead
  of direct _id and _seq access, in preparation for FID-on-OST
  changes.  Update lfsck code to handle new structures.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
  Change-Id: If18f5ed34744b8372687472843ccc09108500c1e
  Change-Id: I05b5da92efbedb7b92c6de736c05beef30500c1e

  LU-2677 lfsck: handle smaller lustre_mdt_attrs

  In 2.4 the lustre_mdt_attrs (LMA) structure was shrunk to move out
  the unused SOM fields into a separate structure.  The filter_fid
  structure was shrunk to allow both FF and LMA on 256-byte OST inodes.

  Allow reading both old and new LMA and FF structures, since we only
  care about the initial fields in both of them.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
  Change-Id: If6c75d5ee3192ef3761aa9f645175698ebe5ee36

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoext2fs: check if Lustre filesystem is mounted
Andreas Dilger [Fri, 13 Apr 2012 08:16:24 +0000 (02:16 -0600)]
ext2fs: check if Lustre filesystem is mounted

Add a check to ext2fs_check_mount_point() to loo in /proc/fs/lustre/*
to see if Lustre is mounted, since st_rdev of the mountpoint does not
match st_rdev of the block device itself, which confuses libext2fs.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agodebugfs: dump "fid" and "lma" xattrs on inode stat
Andreas Dilger [Fri, 13 Apr 2012 18:55:45 +0000 (12:55 -0600)]
debugfs: dump "fid" and "lma" xattrs on inode stat

Print out the Lustre "fid" and "lma" object xattr contents,
if present, with debugfs stat to simplify debugging.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoLU-1774 tests: e2fsck -D does not change dirdata
Bobi Jam [Sat, 25 Aug 2012 07:08:59 +0000 (15:08 +0800)]
LU-1774 tests: e2fsck -D does not change dirdata

Add test case for directory optimization to preserve dirdata
content for dot and dotdot entries.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Iae190794da75a2080a8e5cc5b95a49e0c894f72f

12 years agotests: add basic tests for dir_data feature
Andreas Dilger [Fri, 13 Apr 2012 19:42:42 +0000 (13:42 -0600)]
tests: add basic tests for dir_data feature

Signed-off-by: Pravin Shelar <pravin@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: add support for dir_data feature
Andreas Dilger [Fri, 13 Apr 2012 19:39:26 +0000 (13:39 -0600)]
e2fsck: add support for dir_data feature

Add support for the INCOMPAT_DIRDATA feature, which allows
storing extra data in the directory entry beyond the name.
This allows the Lustre File IDentifier to be accessed in
an efficient manner, and would be useful for expanding a
filesystem to allow more than 2^32 inodes in the future.

  LU-1774 e2fsck: e2fsck -D does not change dirdata content

  Fix dir optimization to preserver dirdata content for dot
  and dotdot entries.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
  Change-Id: Iae190794da75a2080a8e5cc5b95a49e0c894f72f

Signed-off-by: Pravin Shelar <pravin@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: verify large xattr inode support
Andreas Dilger [Fri, 13 Apr 2012 08:14:16 +0000 (02:14 -0600)]
tests: verify large xattr inode support

Verify that inodes with large EAs in a secondary inode are working:
* EA inode needs to have EA_INODE_FL set
* EA inode should reference parent inode number+generation

Signed-off-by: Kalpak Shah <kalpak@sun.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: add support for xattrs in external inodes
Andreas Dilger [Fri, 13 Apr 2012 08:04:53 +0000 (02:04 -0600)]
e2fsck: add support for xattrs in external inodes

Add support for the INCOMPAT_EA_INODE feature, which stores large
extended attributes into an external inode instead of data blocks.
The inode is referenced by the e_value_inum field (formerly the
unused e_value_block field) from the extent header, and stores the
xattr data starting at byte offset 0 in the inode data block.

The xattr inode stores the referring inode number in its i_mtime,
and the parent i_generation in its own i_generation, so that there
is a solid linkage between the two that e2fsck can verify.  The
xattr inode is itself marked with EXT4_EA_INODE_FL as well.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: clean up xattr checking code, add test
Andreas Dilger [Fri, 13 Apr 2012 08:01:12 +0000 (02:01 -0600)]
e2fsck: clean up xattr checking code, add test

Clean up xattr header/list processing for in-inode xattrs instead
of doing lots of explicit pointer math.  Add a regression test for
in-inode xattrs.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: add checks for journal checksum feature
Andreas Dilger [Fri, 13 Apr 2012 07:50:29 +0000 (01:50 -0600)]
tests: add checks for journal checksum feature

f_jchksum_bblk: journal checksum feature where there is a corrupt
block in an uncommitted transaction
f_jchksum_blast_trans: incomplete last trans not considered bad
f_jchksum_remount: check journal mounted by a kernel without
CHECKSUM support after CHECKSUM is in journal superblock

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: create random filesystem, corrupt, e2fsck
Andreas Dilger [Fri, 13 Apr 2012 07:53:39 +0000 (01:53 -0600)]
tests: create random filesystem, corrupt, e2fsck

The f_random_corruption test enables a random subset of filesystem
features, picks one of the valid filesystem block and inode sizes,
and a random device size and creates a new filesystem with those
parameters.

It is possible to disable the running of the test by setting the
environment variable F_RANDOM_CORRUPTION=skip.  By default the test
script is run only one time, but setting the LOOP_COUNT variable
allows the test to run multiple times.

If the script is running as root the filesystem is mounted and
populated with file data to allow a more useful test filesystem
to be generated.  In some cases the kernel may not support the
requested filesystem features and the filesystem cannot be mounted.
This is not considered a test failure.

The resulting filesystem is corrupted with both random data and
by shifting data from one part of the device to another and then
repaired by e2fsck.  In some rare cases the random corruption is
severe enough that the filesystem is not recoverable (e.g. small
filesystem with no backup superblock has bad superblock corruption)
but in most cases "e2fsck -fy" should be able to fix all errors
in some way.

After e2fsck has repaired the filesystem, it is optionally mounted
(if the environment variable MOUNT_AFTER_CORRUPTION=yes is set) and
the test files created in the filesystem are deleted.  This verifies
that the fixes in the filesystem are sufficient for the kernel to
use the filesystem without error.  Since there is some possibility
of the kernel oopsing if there is a filesystem bug, this part of
the test is not enabled by default.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: add test cases for inode badness
Andreas Dilger [Fri, 13 Apr 2012 07:23:17 +0000 (01:23 -0600)]
tests: add test cases for inode badness

Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: track errors/badness found for each inode
Andreas Dilger [Fri, 13 Apr 2012 07:13:58 +0000 (01:13 -0600)]
e2fsck: track errors/badness found for each inode

The present e2fsck code checks the inode, per field basis.  It
doesn't take into consideration to total sanity of the inode.
This may cause e2fsck turning a garbage inode into an apparently
sane inode ("It is a vessel of fertilizer, and none may abide
its strength.").

The following patch adds a heuristics to detect the degree of
badness of an inode. icount mechanism is used to keep track of
the badness of every inode.  The badness is increased as various
fields in inode are found to be corrupt.  Badness above a certain
threshold value results in deletion of the inode.  The default
badness threshold value is 7, it can be specified to e2fsck
using "-E inode_badness_threshold=<value>"

This can avoid lengthy pass1b shared block processing, where a
corrupt chunk of the inode table has resulted in a bunch of
garbage inodes suddenly having shared blocks with a lot of good
inodes (or each other).

Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: add tests for expanding inode extra size
Andreas Dilger [Fri, 13 Apr 2012 00:05:03 +0000 (18:05 -0600)]
tests: add tests for expanding inode extra size

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: add support for expanding the inode size
Andreas Dilger [Fri, 13 Apr 2012 00:03:37 +0000 (18:03 -0600)]
e2fsck: add support for expanding the inode size

This patch adds a "-E expand_extra_isize" feature which makes sure
that _every_ used inode has i_extra_isize >= s_min_extra_isize if
s_min_extra_isize is set. Else it makes sure that i_extra_isize
of every inode is equal to sizeof(ext2_inode_large) - 128.

This is useful for the case where nanosecond timestamps or 64-bit
inode version fields are required for all inodes in the filesystem.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: ignore xattr feature in backup superblocks
Andreas Dilger [Fri, 13 Apr 2012 18:25:25 +0000 (12:25 -0600)]
e2fsck: ignore xattr feature in backup superblocks

Since the xattr feature is enabled automatically by the kernel,
it can cause spurious e2fsck runs on a clean filesystem due to
differences between the primary and backup superblocks.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: PAGE_SIZE larger than blocksize with hole
Andreas Dilger [Thu, 9 Aug 2012 05:23:22 +0000 (23:23 -0600)]
tests: PAGE_SIZE larger than blocksize with hole

Verify correct operation in the case of writing files with allocated
blocks at the end of the file beyond i_size.  This can happen for
PAGE_SIZE > blocksize, or through fallocate().

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: handle preallocation for large PAGE_SIZE
Andreas Dilger [Fri, 13 Apr 2012 07:59:31 +0000 (01:59 -0600)]
e2fsck: handle preallocation for large PAGE_SIZE

Fix handling of block preallocation support in cases where the kernel
PAGE_SIZE is larger than the filesystem blocksize.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: add tests for uninitialized bitmaps
Andreas Dilger [Thu, 12 Apr 2012 23:52:44 +0000 (17:52 -0600)]
tests: add tests for uninitialized bitmaps

Various tests for handing uninitialized block and inode bitmaps,
and inodes beyond the in-use high watermark.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotune2fs: warn if the filesystem journal is dirty
Andreas Dilger [Thu, 12 Apr 2012 23:38:13 +0000 (17:38 -0600)]
tune2fs: warn if the filesystem journal is dirty

Running tune2fs on a filesystem with an unrecovered journal can
cause the tune2fs settings to be reverted when the journal is
replayed.  Print a warning if this is detected so that the user
isn't surprised if it happens.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: allow deleting or zeroing shared blocks
Andreas Dilger [Thu, 12 Apr 2012 23:32:53 +0000 (17:32 -0600)]
e2fsck: allow deleting or zeroing shared blocks

E2fsck fixes files that are found to be sharing blocks by cloning
the shared blocks and giving each file a private copy in pass 1D.

Allowing all files claiming the shared blocks to have copies can
inadvertantly bypass access restrictions.  Deleting all the files,
zeroing the cloned blocks, or placing the files in the /lost+found
directory after cloning may be preferable in some secure environments.

The following patches implement config file and command line options
in e2fsck that allow pass 1D behavior to be tuned according to site
policy.  It adds two extended options and config file counterparts.
On the command line:

 -E clone=dup|zero

    Select the block cloning method.  "dup" is old behavior,
    and is the default.  "zero" is a new method that substitutes
    zero-filled blocks for the shared blocks in all the files
    that claim them.

 -E shared=preserve|lost+found|delete

    Select the disposition of files containing shared blocks.
    "preserve" is the old behavior which remains the default.
    "lost+found" causes files to be unlinked after cloning so
    they will be reconnected to /lost+found in pass 3.
    "delete" skips cloning entirely and simply deletes the files.

In the config file:
  [options]
      clone=dup|zero
      shared=preserve|lost+found|delete

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: parse config file before command-line opts
Andreas Dilger [Thu, 12 Apr 2012 23:24:55 +0000 (17:24 -0600)]
e2fsck: parse config file before command-line opts

The patch changes the order that the config file and command line
are parsed so that command line has precedence.  It also parses
the -E option for every occurrence, otherwise the -E option is
not cumulative.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: invalid value of in-inode EA offset
Andreas Dilger [Thu, 12 Apr 2012 22:57:40 +0000 (16:57 -0600)]
tests: invalid value of in-inode EA offset

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: extent pointing to non-existent block
Andreas Dilger [Fri, 25 May 2012 07:01:28 +0000 (01:01 -0600)]
tests: extent pointing to non-existent block

Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: workaround for old extents tests
Andreas Dilger [Thu, 12 Apr 2012 22:15:07 +0000 (16:15 -0600)]
e2fsck: workaround for old extents tests

The e2fsck_ext2fs_extent_get() part of this patch is a workaround
to handle problems with old Lustre extents patches that didn't
clear the ee_start_hi or ei_leaf_hi fields.

That has been fixed for long time and could be removed as soon
as the f_extent_* tests are fixed to clear these _hi fields.
Otherwise the extents are all marked as corrupt and it ruins those
tests value.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: verify > 65000 subdirectories
Andreas Dilger [Thu, 12 Apr 2012 22:02:12 +0000 (16:02 -0600)]
tests: verify > 65000 subdirectories

Add test case to verify nlink handling of large directories.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoTT-177 build: add .spec file for SLES11 packaging
Andreas Dilger [Fri, 13 Apr 2012 08:23:12 +0000 (02:23 -0600)]
TT-177 build: add .spec file for SLES11 packaging

Include the upstream SLES11 .spec file to ensure the packages we
build match the upstream packages.  Any later patches that change
the packaging should patch the .spec file appropriately.

Add in the SLES-specific patches, excluding the replacement de.po
file, since the original SLES11 de.po file is only against 1.41.4,
and is missing a large number of changes to the translated messages
related to 64-bit format specifiers.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I783d58bd78d7c4c66cc85ec5557ae1aaf64016ba

12 years agobuild: add RHEL6 .spec file for packaging
Andreas Dilger [Fri, 13 Apr 2012 08:19:19 +0000 (02:19 -0600)]
build: add RHEL6 .spec file for packaging

Include the upstream RHEL6 .spec file to ensure the packages we
build match the upstream packages.  Any later patches that change
the packaging should patch the .spec file appropriately.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agobuild: update e2fsprogs.spec for distro builds
Andreas Dilger [Thu, 12 Apr 2012 21:39:04 +0000 (15:39 -0600)]
build: update e2fsprogs.spec for distro builds

Add the distro version to the RPM release number, so that it the
RPM names do not conflict.

Allow the RPM built from upstream to replace the split packages
provided by the distros.  At some point in the future it may be
desirable to also split the RPM built by this spec file, but this
is complicated by the fact that SLES and RHEL have different splits.

Signed-off-by: Girish Shilamkar <girish.shilamkar@sun.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agofilefrag: Lustre changes to filefrag FIEMAP handling
Andreas Dilger [Thu, 12 Apr 2012 21:31:35 +0000 (15:31 -0600)]
filefrag: Lustre changes to filefrag FIEMAP handling

Add support for multiple-device filesystems by defining a new
fe_device field in the fiemap_extent structure.  This allows
printing the filesystem-relative or linux block device number
associated with each extent of a file.  If a single filesystem
extent is mirrored to multiple block devices, the fe_device
field can be used to disambiguate the multiple copies.

If the "-l" (device-logical) option is given to filefrag, then
all extents for a particular device of a file are returned
before returning extents for the next device.  This makes it
easier to see if extent allocation within a single device is
contiguous, instead of returning all of the blocks of a file
interleaved in file-logical-offset order.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoblkid: fix ZFS device detection
Andreas Dilger [Thu, 12 Apr 2012 21:26:49 +0000 (15:26 -0600)]
blkid: fix ZFS device detection

Fix the ZFS device detection by looking at multiple uberblocks to
see if any are present, rather than looking for the ZFS boot block
which is not always present.

There may be up to 128 uberblocks, but the first 4 are not written
to disk on a newly-formatted filesystem so check several of them at
different offsets within the uberblock array.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoe2fsck: improve in-inode xattr checks
Andreas Dilger [Thu, 12 Apr 2012 21:23:47 +0000 (15:23 -0600)]
e2fsck: improve in-inode xattr checks

Add check for in-inode xattr to make sure that it is not referencing
an offset that is beyond the end of the inode.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agobuild: fix build warnings for MacOS
Andreas Dilger [Fri, 27 Apr 2012 05:22:45 +0000 (23:22 -0600)]
build: fix build warnings for MacOS

The BLKFLSBUF and FDFLUSH ioctls are Linux specific, and do not
really have anything to do with __GNUC__ (which is also used on
OS/X and Solaris).  Only print these warnings on Linux systems.

O_DIRECT is not defined in the OS/X headers.  Since this is only a
performance enhancement, and not required for correct operation,
just ignore it if undefined.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agotests: make generated test scripts read-only
Andreas Dilger [Wed, 23 May 2012 21:05:21 +0000 (15:05 -0600)]
tests: make generated test scripts read-only

Make generated test scripts read-only, to avoid errors by developers
editing the generated test scripts and then having them accidentally
clobbered when "make" is run again.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agobuild: update version for Lustre build
Andreas Dilger [Thu, 12 Apr 2012 20:00:07 +0000 (14:00 -0600)]
build: update version for Lustre build

Add Whamcloud-specific build version to distinguish packages from
upstream packages.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
12 years agoblkid: remove no-op statement which caused a clang warning
Theodore Ts'o [Wed, 13 Mar 2013 18:34:08 +0000 (14:34 -0400)]
blkid: remove no-op statement which caused a clang warning

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: fix command failures for extent_inode commands that take arguments
Theodore Ts'o [Wed, 13 Mar 2013 18:19:16 +0000 (14:19 -0400)]
debugfs: fix command failures for extent_inode commands that take arguments

The extent_inode commands split_node, replace_node, and insert_node
take arguments which resulted in confusing error messages after
succeeding.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: fix build failure with --enable-jbd-debug
Theodore Ts'o [Wed, 13 Mar 2013 18:02:53 +0000 (14:02 -0400)]
e2fsck: fix build failure with --enable-jbd-debug

Commit e3507739e4185 introduced a build failure if e2fsprogs is
configured with --enable-jbd-debug.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: Provide prototype for ext2fs_symlink()
Jan Kara [Mon, 25 Feb 2013 05:55:07 +0000 (05:55 +0000)]
libext2fs: Provide prototype for ext2fs_symlink()

New function ext2fs_symlink() doesn't have a prototype in ext2fs.h and
thus debugfs compilation gives warning:

debugfs.c:2219:2: warning: implicit declaration of function 'ext2fs_symlink'

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2p: Fix 's' handling in parse_num_blocks2()
Jan Kara [Mon, 25 Feb 2013 05:55:05 +0000 (05:55 +0000)]
e2p: Fix 's' handling in parse_num_blocks2()

parse_num_blocks2() wrongly did:
num << 1;
when log_block_size < 0. That is obviously wrong as such statement has
no effect (and the compiler properly warns about it). Callers expect
returned value to be in bytes when log_block_size < 0 so fix the
statement accordingly.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agochattr: allow clearing the extent flag
Theodore Ts'o [Sat, 23 Feb 2013 03:23:05 +0000 (22:23 -0500)]
chattr: allow clearing the extent flag

In order to support kernels which support conversion of extent-mapped
files to direct/indirect mapped files, remove the sanity check which
prevented clearing the extent flag in chattr.  Kernels which don't
support this will simply give an Operation Not Supported error.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: add sanity check to make sure we never shift 64 bits right
Theodore Ts'o [Mon, 28 Jan 2013 14:02:23 +0000 (09:02 -0500)]
debugfs: add sanity check to make sure we never shift 64 bits right

In the tables which are used to parse the fields for the set_fields
command, there should never be a entry which has a size set to 8
bytes, and two pointers defined.  Not only would it result in
undefined behavior in the compiled code, it doesn't make any sense and
is definitely a bug.

Reported-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Mon, 28 Jan 2013 03:44:56 +0000 (22:44 -0500)]
po: update de.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoFix warnings about functions not returning a value
Philipp Thomas [Mon, 28 Jan 2013 03:41:44 +0000 (22:41 -0500)]
Fix warnings about functions not returning a value

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agobuild: quiet build warnings for "gcc -Wall"
Andreas Dilger [Mon, 28 Jan 2013 03:29:01 +0000 (22:29 -0500)]
build: quiet build warnings for "gcc -Wall"

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agocontrib: add missing '-p' to fallocate's usage message
Zheng Liu [Fri, 25 Jan 2013 03:44:19 +0000 (11:44 +0800)]
contrib: add missing '-p' to fallocate's usage message

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix ext2fs_llseek on i386
Phillip Susi [Thu, 24 Jan 2013 16:21:56 +0000 (11:21 -0500)]
libext2fs: fix ext2fs_llseek on i386

ext2fs_llseek() was using lseek instead of lseek64.  The
only time it would use lseek64 is if passed an offset that
overflowed 32 bits.  This works for SEEK_SET, but not
SEEK_CUR, which can apply a small offset to move the file
pointer past the 32 bit limit.

The code has been changed to instead try lseek64 first, and
fall back to lseek if that fails.  It also was doing a
runtime check of the size of off_t.  This has been moved to
compile time.

This fixes a problem which would cause e2image when built for
x86-32 to bomb out when used with large file systems.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate Release Notes, Changelogs, version.h, for final 1.42.7 release v1.42.7
Theodore Ts'o [Tue, 22 Jan 2013 03:03:18 +0000 (22:03 -0500)]
Update Release Notes, Changelogs, version.h, for final 1.42.7 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs, tune2fs, resize2fs: add warning messages for bigalloc and quota
Theodore Ts'o [Tue, 22 Jan 2013 00:07:38 +0000 (19:07 -0500)]
mke2fs, tune2fs, resize2fs: add warning messages for bigalloc and quota

The bigalloc and quota features have some known issues, so issue
warnings in case users try to use them.

More information can be found here:
https://ext4.wiki.kernel.org/index.php/Bigalloc
https://ext4.wiki.kernel.org/index.php/Quota

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agocontrib: fix namespace leakage in spd_readdir
Theodore Ts'o [Mon, 21 Jan 2013 22:19:50 +0000 (17:19 -0500)]
contrib: fix namespace leakage in spd_readdir

Declare the internal symbols alloc_dirstruct() and cache_dirstruct()
as static so they don't leak out into the global namespace.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agocontrib: add thread locking and readdir64_r support to spd_readdir
Theodore Ts'o [Mon, 21 Jan 2013 22:15:25 +0000 (17:15 -0500)]
contrib: add thread locking and readdir64_r support to spd_readdir

This is part of a series of improvements from a 2008 version of
spd_readdir.c that somehow didn't make it into the version which we
checked into e2fsprogs git tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agocontrib: add safe_getenv() support to spd_readdir
Theodore Ts'o [Mon, 21 Jan 2013 21:35:16 +0000 (16:35 -0500)]
contrib: add safe_getenv() support to spd_readdir

This is part of a series of improvements from a 2008 version of
spd_readdir.c that somehow didn't make it into the version which we
checked into e2fsprogs git tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: move a cluster at a time with bigalloc file systems
Theodore Ts'o [Sun, 20 Jan 2013 05:25:00 +0000 (00:25 -0500)]
resize2fs: move a cluster at a time with bigalloc file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: correctly account for clusters when calculating summary stats
Theodore Ts'o [Sun, 20 Jan 2013 04:41:36 +0000 (23:41 -0500)]
resize2fs: correctly account for clusters when calculating summary stats

Fixes resize2fs so it correctly calculates the number of free clusters
in each block group for file systems with the bigalloc feature
enabled.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: teach the ext2fs_*_block_bitmap_range2() about clusters
Theodore Ts'o [Sun, 20 Jan 2013 04:21:11 +0000 (23:21 -0500)]
libext2fs: teach the ext2fs_*_block_bitmap_range2() about clusters

The ext2fs_{mark,unmark,test}_block_bitmap2() functions understand
about clusters, and will take block numbers and convert them to
clusters before checking the bitmap.  The
ext2fs_*_block_bitmap_range2() functions did not do this, which made
them inconsistent.  Fortunately, nothing has depended on this
incorrect behavior, and in fact most of the usage of these functions
have only recently been added, and only for optimizations that were
only enabled for non-bigalloc file systems.

So this is a change in previously exported functions, but (a) it
doesn't change the behavior at all for non-bigalloc file systems, and
(b) the change is more likely to fix bugs for bigalloc file systems.
For example, this change fixes a problem with resize2fs and bigalloc
file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate Release Notes, Changelogs, version.h, etc. for 1.42.7 release
Theodore Ts'o [Wed, 16 Jan 2013 18:50:12 +0000 (13:50 -0500)]
Update Release Notes, Changelogs, version.h, etc. for 1.42.7 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: check in test-resize script
Theodore Ts'o [Wed, 16 Jan 2013 18:43:36 +0000 (13:43 -0500)]
resize2fs: check in test-resize script

This should be made into a more formal, automated test case, but for
now, save this as script since it's useful for validating resize2fs's
handling of very large file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate config.{guess,sub} to the latest version
Theodore Ts'o [Wed, 16 Jan 2013 18:10:54 +0000 (13:10 -0500)]
Update config.{guess,sub} to the latest version

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Wed, 16 Jan 2013 04:30:36 +0000 (23:30 -0500)]
po: update vi.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Wed, 16 Jan 2013 04:30:36 +0000 (23:30 -0500)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Wed, 16 Jan 2013 04:30:36 +0000 (23:30 -0500)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Wed, 16 Jan 2013 04:30:36 +0000 (23:30 -0500)]
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Wed, 16 Jan 2013 04:30:35 +0000 (23:30 -0500)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Wed, 16 Jan 2013 04:30:35 +0000 (23:30 -0500)]
po: update de.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Wed, 16 Jan 2013 04:30:35 +0000 (23:30 -0500)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoUpdate misc/Makefile.in using "make depend"
Theodore Ts'o [Wed, 16 Jan 2013 04:28:17 +0000 (23:28 -0500)]
Update misc/Makefile.in using "make depend"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2image: add -a switch to include all data
Phillip Susi [Tue, 15 Jan 2013 20:31:23 +0000 (15:31 -0500)]
e2image: add -a switch to include all data

Normally the raw and QCOW2 images only contain fs metadata.
Add a new switch ( -a ) to include all data.  This makes it
possible to use e2image to clone a whole filesystem.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotests: create test for debugfs creating special files
Theodore Ts'o [Tue, 15 Jan 2013 19:52:30 +0000 (14:52 -0500)]
tests: create test for debugfs creating special files

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: fix mknod command so that it updates the block group statistics
Theodore Ts'o [Tue, 15 Jan 2013 19:50:02 +0000 (14:50 -0500)]
debugfs: fix mknod command so that it updates the block group statistics

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: add symlink command
Darren Hart [Fri, 4 Jan 2013 20:00:59 +0000 (12:00 -0800)]
debugfs: add symlink command

Add support for symbolic links using a new symlink command.  Modeled
after the do_mkdir() command.

Testing demonstrates both fastlinks and slowlinks work correctly.
Very long target paths fail as the command parsing appears to truncate
the input to somewhere around 256 bytes.

Signed-off-by: Darren Hart <dvhart@infradead.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger@dilger.ca>
12 years agolibext2fs: add the ext2fs_symlink() function
Darren Hart [Fri, 4 Jan 2013 20:00:58 +0000 (12:00 -0800)]
libext2fs: add the ext2fs_symlink() function

Creating symlinks is a complex affair when accounting for slowlinks.

Create a new function, ext2fs_symlink(), modeled after ext2fs_mkdir().
Like ext2fs_mkdir(), ext2fs_symlink() takes on the task of allocating a
new inode and block (for slowlinks), setting up sane default values in
the inode, copying the target path to either the inode (for fastlinks)
or to the first block (for slowlinks), and accounting for the inode and
block stats.  Disallow link targets longer than blocksize as the Linux
kernel prevents this.

It does not attempt to expand the parent directory, instead returning
EXT2_ET_DIR_NO_SPACE and leaving it to the caller to expand just as
ext2fs_mkdir() does.  Ideally, I think both of these functions should
make a single attempt to expand the directory.

[ Fixed a few bugs discovered when creating a test case for ext2fs_symlink() ]

Signed-off-by: Darren Hart <dvhart@infradead.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger@dilger.ca>
12 years agolibext2fs: add error codes from 1.43.x development branch
Theodore Ts'o [Wed, 16 Jan 2013 19:07:25 +0000 (14:07 -0500)]
libext2fs: add error codes from 1.43.x development branch

To maintain the error codes numbering, we need to pull in the changes
from the 1.43.x development branch for the libext2's error table.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: document bigalloc and cluster-size
Zheng Liu [Sun, 13 Jan 2013 09:08:15 +0000 (17:08 +0800)]
mke2fs: document bigalloc and cluster-size

Bigalloc feature has been used for a long time, but the documentation
in mke2fs is still missing.  So add it.

Addresses-Debian-Bug: #669730

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: avoid 32-bit overflow in ext2fs_initialize with a 512M cluster size
Theodore Ts'o [Tue, 15 Jan 2013 00:29:54 +0000 (19:29 -0500)]
libext2fs: avoid 32-bit overflow in ext2fs_initialize with a 512M cluster size

If the user attemps to create a 512MB cluster, we need to adjust the
defaults to avoid a 32-bit overflow of s_blocks_per_group.  Also check
to make sure that the caller of ext2fs_initialize() has not given a
value of s_clusters_per_group that would result in an overflow of
s_blocks_per_group.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
12 years agomke2fs: teach mke2fs to understand -b 4k and -C 256M
Theodore Ts'o [Tue, 15 Jan 2013 00:03:11 +0000 (19:03 -0500)]
mke2fs: teach mke2fs to understand -b 4k and -C 256M

The -b and -C options now use parse_num_blocks2() instead of strtol,
so that users can specify -C 256M instead of the much less convenient
-C 268435456.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
12 years agolibe2p: teach parse_num_blocks2() to return bytes if log_block_size < 0
Theodore Ts'o [Tue, 15 Jan 2013 00:01:25 +0000 (19:01 -0500)]
libe2p: teach parse_num_blocks2() to return bytes if log_block_size < 0

Previously the behavior of parse_num_block2 was undefined if
log_block_size was less than zero.  It will now return a number in
units of bytes.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
12 years agomke2fs: the -g option will now specify the clusters per block group
Theodore Ts'o [Mon, 14 Jan 2013 22:30:23 +0000 (17:30 -0500)]
mke2fs: the -g option will now specify the clusters per block group

If bigalloc is enabled, then -g will specify the clusters per block
group.  (If bigalloc is not enabled, then a cluster == a block, so the
meaning of -g is not changed.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
12 years agomke2fs: enforce that the cluster size must be greater that the block size
Theodore Ts'o [Mon, 14 Jan 2013 22:28:00 +0000 (17:28 -0500)]
mke2fs: enforce that the cluster size must be greater that the block size

In addition, do not allow a cluster size of 1024, since that will be
interpreted by ext2fs_initialize() as requesting the default cluster
size.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Reported-by: Zheng Liu <wenqing.lz@taobao.com>
12 years agomke2fs: require the bigalloc feature explicity if the cluster size is set
Zheng Liu [Sun, 13 Jan 2013 09:08:13 +0000 (17:08 +0800)]
mke2fs: require the bigalloc feature explicity if the cluster size is set

When cluster-size is specified without the bigalloc feature, mke2fs
will ignore this argument silently.  But user might think bigalloc
feature has been enabled unless they use the dumpe2fs command.  So now
we ask user to set bigalloc feature explicity when cluster-size is
enabled.  This can make sure that users understand what they are doing
because bigalloc might impact the performance for some workloads.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: fix gcc-wall complaints
Theodore Ts'o [Mon, 14 Jan 2013 19:41:46 +0000 (14:41 -0500)]
debugfs: fix gcc-wall complaints

Fix the missing function prototypes from the recently added new
debugfs commands, plus some signed vs unsigned comparison complaints.

Also change the abbreviation of the block_dump command from "bp" to
the more appropriate "bp".

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: add debugging code to test the old online resizing interfaces
Theodore Ts'o [Sat, 12 Jan 2013 22:33:44 +0000 (17:33 -0500)]
resize2fs: add debugging code to test the old online resizing interfaces

The old online resize ioctl interfaces are still present in the
kernel, and we want to make it easy to test both the kernel code for
those older interfaces, and resize2fs's use of those interfaces in a
relatively easy manner.

To do this, resize2fs will now check the environment variable
RESIZE2FS_KERNEL_VERSION.  If the version given is less than 3.3, then
do not try using the new resizing ioctl, but instead use the resizing
ioctls that were used before Linux version 3.3.

If the version given is less than 3.7, then emulate sanity checks
which get done to protect against the fact that the new resizing ioctl
prior to 3.7 did not handle meta_bg resizing.  (This was previously
tested via the presence of the RESIZE2FS_NO_META_BG_RESIZE environment
variable.  But the new environment variable, RESIZE2FS_KERNEL_VERISON,
is more general.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
12 years agodebugfs: document zap_block & block_dump
Eric Sandeen [Fri, 11 Jan 2013 07:40:25 +0000 (07:40 +0000)]
debugfs: document zap_block & block_dump

What little docs there were had a cut & paste error.
We can do better. :)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoconfig: silence printf format warnings
Eric Whitney [Fri, 4 Jan 2013 10:27:12 +0000 (10:27 +0000)]
config: silence printf format warnings

The printfs in the asm_types.c code contained within parse-types.sh
expect sizeof to return an int.  Fix this for architectures where this
isn't true (x86_64, etc.) so we don't see warning messages while
running the configure script.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: ext2fs_open2() should not set ret_fs after a MMP failure
Theodore Ts'o [Wed, 9 Jan 2013 01:47:11 +0000 (20:47 -0500)]
libext2fs: ext2fs_open2() should not set ret_fs after a MMP failure

The addition of MMP code was added in the wrong place, so ret_fs could
get set (and EXT2_FLAG_NOFREE_ON_ERROR was cleared as well, which
could confuse e2fsck which depends on this flag being cleared if
ext2fs_open2() succeeded.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: avoid memory corruption on ext2fs_open2 failure
Nickolai Zeldovich [Tue, 8 Jan 2013 20:45:31 +0000 (15:45 -0500)]
e2fsck: avoid memory corruption on ext2fs_open2 failure

In try_open_fs(), if ext2fs_open2() returns an error, do not try to
access the struct ext2_filesys.  The previous check 'if (ret_fs)' was
always true, but even 'if (*ret_fs)' might be incorrect in some cases,
so check 'retval==0' instead.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: do not crash on long log file names
Nickolai Zeldovich [Tue, 8 Jan 2013 20:31:18 +0000 (15:31 -0500)]
e2fsck: do not crash on long log file names

Previously e2fsck would corrupt memory if the log file name was longer
than 100 bytes (e.g., a long log_filename value in e2fsck.conf or a
pattern that expands out to more than 100 bytes).  This was due to
incorrectly calling realloc() in append_string() on the struct string
instead of the malloc'ed char* buffer, among other problems.  This
patch fixes the call to realloc() and also ensures that the buffer is
grown by sufficiently many bytes (not just by 2x).

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: show size requested when memory allocation fails
Eric Sandeen [Mon, 7 Jan 2013 21:45:54 +0000 (15:45 -0600)]
e2fsck: show size requested when memory allocation fails

"e2fsck: Can't allocate dx_block info array"
is only so helpful - it'd be nice to know how much it tried to allocate.

In particular, since I think malloc(0) can return NULL,
it'd be nice to know if maybe we passed in an uninitialized (or
0-initialized) size.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: check extents feature when bigalloc feature is enabled
Zheng Liu [Sun, 6 Jan 2013 12:25:17 +0000 (20:25 +0800)]
mke2fs: check extents feature when bigalloc feature is enabled

When bigalloc feature is enabled in mkfs, extents feature also needs
to be enabled.  But now when bigalloc feature is enabled without
extents feature, users will not get any warning messages until they
try to mount this file system.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoFix 32-bit overflow problems: dgrp_t * s_blocks_per_group
Theodore Ts'o [Thu, 3 Jan 2013 18:42:38 +0000 (13:42 -0500)]
Fix 32-bit overflow problems: dgrp_t * s_blocks_per_group

There are a number of places where we multiply a dgrp_t with
s_blocks_per_group expecting that we will get a blk64_t.  This
requires a cast, or using the convenience function
ext2fs_group_first_block2().

This audit was suggested by Eric Sandeen.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
12 years agoresize2fs: use [un]mark_block_range bitmap functions to reduce CPU usage
Theodore Ts'o [Thu, 3 Jan 2013 13:35:25 +0000 (08:35 -0500)]
resize2fs: use [un]mark_block_range bitmap functions to reduce CPU usage

Use ext2fs_[un]mark_block_range2() functions to reduce the CPU
overhead of resizing large file systems by 45%, primarily by
reducing the time spent in fix_uninit_block_bitmaps().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: add resource tracking as a debug option
Theodore Ts'o [Thu, 3 Jan 2013 03:43:36 +0000 (22:43 -0500)]
resize2fs: add resource tracking as a debug option

Add a new debug flag which prints how much time is consumed by the
various parts of resize2fs's processing.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: fix 32-bit overflow when calculating the number of free blocks
Theodore Ts'o [Thu, 3 Jan 2013 14:01:22 +0000 (09:01 -0500)]
resize2fs: fix 32-bit overflow when calculating the number of free blocks

This caused the free blocks count in the superblock to be incorrect
after resizing a 64-bit file system if the number of free blocks
overflowed a 32-bit value.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: fix 32-bit overflow issue which can corrupt 64-bit file systems
Theodore Ts'o [Thu, 3 Jan 2013 04:31:04 +0000 (23:31 -0500)]
resize2fs: fix 32-bit overflow issue which can corrupt 64-bit file systems

Fix a 32-bit overflow bug caused by a missing blk64_t cast which can
cause the block bitmap to get corrupted when doing an off-line resize
of a 64-bit file system.

This problem can be reproduced as follows:

rm -f foo.img; touch foo.img
truncate -s 8T foo.img
mke2fs -F -t ext4 -O 64bit foo.img
e2fsck -f foo.img
truncate -s 21T foo.img
resize2fs foo.img
e2fsck -fy foo.img

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoClean up texinfo files
Theodore Ts'o [Wed, 2 Jan 2013 15:06:09 +0000 (10:06 -0500)]
Clean up texinfo files

Fix up the com_err.texinfo file so it will produce a valid printed
output, by cleaning up some errors in the texinfo file, and updating
texinfo.tex to be consistent with the version in the doc subdirectory.

Also add rules so we can generate pdf and ps files from
com_err.texinfo and libext2fs.texinfo.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>