Whamcloud - gitweb
tools/e2fsprogs.git
5 years agobuild: run long tests for RPMs, and run them in parallel 70/33570/2 v1.44.3.wc1-lustre v1.44.3.wc1
Andreas Dilger [Sat, 3 Nov 2018 22:07:34 +0000 (16:07 -0600)]
build: run long tests for RPMs, and run them in parallel

Change the "make check" in the RPM .spec.in files to run all of the
tests ("fullcheck" vs. only "check", which now excludes slow tests
by default), but change the .spec file to run the tests in parallel.

This allows long-running tests to start and wait in the background,
while allowing some short-running to actually do work in the meantime.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I36d8d64907c58ceb25bb955edeeac4e1e53ebbe5
Reviewed-on: https://review.whamcloud.com/33570
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
5 years agoLU-1365 e2fsck: allow to check >2GB sized directory 13/33813/4
c17828 [Mon, 10 Dec 2018 08:12:05 +0000 (11:12 +0300)]
LU-1365 e2fsck: allow to check >2GB sized directory

After large_dir feature has been added, e2fsprogs is
ready for directories > 2GB, so we can remove e2fsck
directory size check if large_dir is enabled, so
directory is limited only by allowed blocks count.

Change-Id: I14da0816ee87875df8bf298cf4e06db4b9522767
Signed-off-by: Artem Blagodarenko <c17828@cray.com>
Reviewed-on: https://review.whamcloud.com/33813
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
5 years agoLU-1365 debugfs: output large directory size 14/33814/3
c17828 [Mon, 10 Dec 2018 08:59:36 +0000 (11:59 +0300)]
LU-1365 debugfs: output large directory size

Use hight part of directory size in debugfs output.

Change-Id: I9d82d72b9bc8b10b9d8c0768911672892aef06e9
Signed-off-by: Artem Blagodarenko <c17828@cray.com>
Reviewed-on: https://review.whamcloud.com/33814
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
5 years agodebugfs: fix ncheck so it handles hard links correctly 75/33575/3
Jaco Kroon [Thu, 2 Aug 2018 18:06:46 +0000 (20:06 +0200)]
debugfs: fix ncheck so it handles hard links correctly

Due to hard links inodes can have multiple names (except for folders),
ncheck should find all of the names (equal to the number of links to the
inodes, directories excepted), not names to the count of the provided
inodes.

Commit: 4a30e2ae7ced039189ee438065b2f656d83e7e44
Change-Id: I09ae767057ce5c89b6232f1e9bbc94db4fc4e9c1
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-on: https://review.whamcloud.com/33575
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
5 years agoLU-11545 debugfs: mask off dir_data flags for ncheck 74/33574/2
Li Dongyang [Mon, 5 Nov 2018 05:48:56 +0000 (16:48 +1100)]
LU-11545 debugfs: mask off dir_data flags for ncheck

Leaving dir_data flags on filetype will confuse "ncheck -c".
This also adds man page and help message for the "-D" option
of ls.

Change-Id: I5bbaf1b6845eaa6c2b6d97818c174f56b669f27d
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/33574
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
5 years agoLU-11215 libe2p: add large_xattr as an alias of ea_inode 32/32932/7
Li Dongyang [Mon, 6 Aug 2018 01:33:44 +0000 (11:33 +1000)]
LU-11215 libe2p: add large_xattr as an alias of ea_inode

The upstream version of large xattr suppport doesn't
add "large_xattr" as a feature name, but it's still
used by our test scripts.

e2fsprogs commit:6a081f6d2a5cff0f5a077065aab39901d54bfb61

Change-Id: I48d7ac54b2b2ad252c404050bc4c3d9527865107
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/32932
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
5 years agoe2fsprogs: fix compile error and warnings for old gcc versions
Li Dongyang [Fri, 13 Jul 2018 23:16:24 +0000 (17:16 -0600)]
e2fsprogs: fix compile error and warnings for old gcc versions

-Wimplicit-fallthrough option was added in gcc7 and
-Wpedantic was added in gcc4.8, while #pragma GCC diagnostic
support was not available until gcc4.6

We got following warnings:
../lib/ext2fs/fiemap.h:35: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
../lib/ext2fs/fiemap.h:36: warning: unknown option after ‘#pragma GCC diagnostic’ kind
../lib/ext2fs/fiemap.h:38: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’

and error:
filefrag.c: In function ‘main’:
filefrag.c:577: error: #pragma GCC diagnostic not allowed inside functions
filefrag.c:578: error: #pragma GCC diagnostic not allowed inside functions
filefrag.c:595: error: #pragma GCC diagnostic not allowed inside functions

when compiling latest e2fsprogs with a gcc older than 4.6
e.g. on CentOS 6.9

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
5 years agoLU-10638 build: add support for Scientific
Alexander Boyko [Thu, 8 Feb 2018 06:43:40 +0000 (01:43 -0500)]
LU-10638 build: add support for Scientific

Add Scientific to Distro with a reference to RHEL.

Signed-off-by: Alexander Boyko <c17825@cray.com>
Change-Id: I05001ee9233e4cac6b2c6b523a374ffdc243394d
Cray-bug-id: MRP-3882
Reviewed-on: https://review.whamcloud.com/31220
Reviewed-by: Artem Blagodarenko <c17828@cray.com>
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
5 years agoLU-8300 e2fsck: print out FID with dirent inode number
Andreas Dilger [Sat, 18 Jun 2016 10:50:41 +0000 (04:50 -0600)]
LU-8300 e2fsck: print out FID with dirent inode number

When printing out the dirent inode number in e2fsck, also print
out the FID, if available, for reference in the future if needed.

   Entry 'lustre.conf' in /ROOT/etc/yum/protected.d (50132) has
   deleted/unused inode=1964 fid=[0x200000401:0x844:0x0].  Clear? yes

This can be useful if LFSCK is able to rebuild the MDT layout from
the OST object xattrs, but the filename isn't stored on the OST.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Id0ec22c47d83f16c392e93328d2869e7a53ebbe5
Reviewed-on: https://review.whamcloud.com/20866
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Artem Blagodarenko <c17828@cray.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
5 years agoLU-9501 mke2fs: avoid inode number error with large FS
Alexey Lyashkov [Mon, 15 May 2017 14:45:38 +0000 (17:45 +0300)]
LU-9501 mke2fs: avoid inode number error with large FS

Limit inodes count instead of error return, to use all inodes in
the filesystem.

Change-Id: I76ee0a6c11b099b8c17d90b0778e3c0f0cf1f60a
Signed-off-by: Alexey Lyashkov <alexey.lyashkov@seagate.com>
Reviewed-on: https://review.whamcloud.com/27111
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
5 years agoLU-6722 jbd: double minimum journal size for RHEL7
Fan Yong [Fri, 26 Jun 2015 15:29:59 +0000 (23:29 +0800)]
LU-6722 jbd: double minimum journal size for RHEL7

In RHEL7 (kernel version >= 3.10.0), the maximum journal transaction
size is reduced to half of the RHEL6 case. That may cause Lustre to
complain that the declared transaction credits too large for very
small journal device. This patch increases the minimum journal size
from 4MB to 8MB for RHEL7 case, then counteract the above limitation
about the journal transaction size.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Iec8a2c561416cb7b5acce342c8ebcb845c8d7a19
Reviewed-on: http://review.whamcloud.com/15401
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
5 years agoLU-5845 build: add support for SUSE_LINUX-12 .spec file
Bob Glossman [Thu, 16 Oct 2014 18:41:07 +0000 (11:41 -0700)]
LU-5845 build: add support for SUSE_LINUX-12 .spec file

Add the SLES 12 .spec file.
For now SLES 12 and SLES 11 can share the same .spec file.

  LU-8390 build: use correct .spec file for SLES 12

  Changes in output from the lsb_release command in SLES 12
  resulted in using the wrong .spec file in builds.
  This patch corrects the problem for old and new versions.

Signed-off-by: Bob Glossman <bob.glossman@intel.com>
  Change-Id: I41d47c305eba7d3dd0d313be5ad8192592291fad
  Reviewed-on: http://review.whamcloud.com/21237
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: I3b716c09ea8632d2333aaf61b8a6c881ccd18a88
Reviewed-on: http://review.whamcloud.com/12316
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
5 years agoLU-5307 build: add support for RHEL-7 .spec file
Andreas Dilger [Fri, 18 Jul 2014 20:47:02 +0000 (14:47 -0600)]
LU-5307 build: add support for RHEL-7 .spec file

Add the RHEL 7 .spec file.

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

5 years agoLU-1540 e2fsck: add missing symlink NUL terminator
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

5 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.

  LU-6093 ext2fs: don't confuse mke2fs by Lustre zfs mount

  check_if_lustre_mounted() by efb735 will mistakenly report the
  device is mounted when there is a ZFS-based Lustre mount.

  This patch fix it by parsing the real device name from the pool
  name exported in Lustre proc file with "zpool" command.

  It also includes a typo fix in check_if_lustre_mounted() and a
  few other code cleanups.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
  Change-Id: I43dabbcd6fa721c569cd9cc0f4a6de93ab761392
  Reviewed-on: http://review.whamcloud.com/14223
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 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.

  LU-8998 debugfs: handle combined LMA EA and PFID EA

  We need to store the stripe size and stripe count information in
  the OST object's PFID EA for the layout LFSCK to recover the MDT
  object or its (lost or corrupted) LOV EA. On the other hand, for
  PFL file, we also need to store its PFL ID and extent information
  in its OST object's PFID EA.

  Consider performance, we will store the PFID EA inside the inode
  body to avoid extra IO when read/write the PFID EA. Unfortunately,
  the space inside current 256-bytes inode for EA is very limited,
  and above enlarged PFID EA exceeds such limitation. So we have to
  make some hack with the PFID EA and LMA EA combined together. The
  patch makes the debugfs tool to handle such case properly.

Signed-off-by: Fan Yong <fan.yong@intel.com>
  Change-Id: I1380d16d94d6d05272e22fdfff07ada038685669
  Reviewed-on: https://review.whamcloud.com/19436
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 years agotests: add basic tests for dirdata feature
Andreas Dilger [Fri, 18 May 2018 04:52:58 +0000 (14:52 +1000)]
tests: add basic tests for dirdata feature

Signed-off-by: Pravin Shelar <pravin@clusterfs.org>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
5 years agoe2fsck: add support for dirdata feature
Andreas Dilger [Thu, 17 May 2018 03:43:16 +0000 (13:43 +1000)]
e2fsck: add support for dirdata 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.

Include this patches:

e2fsck: e2fsck -D does not change dirdata content

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

Lustre-bug: https://jira.hpdd.intel.com/browse/LU-1774
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: Iae190794da75a2080a8e5cc5b95a49e0c894f72f

e2fsprogs: Consider DIRENT_LUFID flag in link_proc().

While adding the new file entry in directory block, link_proc()
calculates minimum record length of the existing directory entry
without considering the dirent data size and which leads to
corruption. Changed the code to use EXT2_DIR_REC_LEN() which will
return correct record length including dirent data size.

Lustre-bug: https://jira.hpdd.intel.com/browse/LU-2462
Signed-off-by: Manisha Salve <msalve@ddn.com>
Change-Id: Ic593c558c47a78183143ec8e99d8385ac94d06f7

libext2fs, e2fsck: don't use ext2_dir_entry_2

Due to endian issues, do not use ext2_dir_entry_2 because it will
have the wrong byte order on directory entries that are swabbed.
Instead, use the standard practice of mask-and-shift to access the
file_type and dirdata flags.

Lustre-bug: https://jira.hpdd.intel.com/browse/LU-4677
Signed-off-by: Pravin Shelar <pravin@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
5 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>
5 years agolibext2fs: add a regression test for in-inode xattrs
Andreas Dilger [Fri, 13 Apr 2012 08:01:12 +0000 (02:01 -0600)]
libext2fs: add a regression test for in-inode xattrs

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

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

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 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>
5 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>
5 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>
5 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.

There is also a fix for test f_itable_collision, the original
E2FSCK_TIME would overflow on a 32bit system when adding with
ctx->time_fudge in EXT4_XTIME_FUTURE, making us increase the
inode badness incorrectly.

  LU-10205 libext2fs: fix buffer overrun in ext2fs_expand_extra_isize

  In ext2fs_expand_extra_isize, we size buffer using 'size' but then
  do the memcpy with the rounded-up size, which can overflow the buffer.

  With MALLOC_CHECK_=2, I see:
  Error in `../e2fsck/e2fsck': free(): invalid pointer: <addr>

  Change-Id: I31be58de12d4d50646c7aa96959de0efc5c279c3
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
  Reviewed-on: https://review.whamcloud.com/29975
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Change-Id: I306ff4f81d8bd6bdf0446c76d6772951043fead4
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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.

Always skip m_hugefile and t_replay_and_set tests, building rpms in
an ext3 environment will make the tests fail.

  LU-4284 build: add missing Provides line in SLES spec file

  Need to add a line in the SUSE spec file for Provides: ldiskfsprogs.
  This is present in the RHEL spec file and is needed to resolve
  dependencies in lustre server rpms at rpm install time.

Signed-off-by: Bob Glossman <bob.glossman@intel.com>
  Change-Id: Ib4821004d27c9a7271ffdbd7403990e586d6c9ca

  LU-9713 build: Require uptodate libcom_err, libss

  Ensure that the libcom_err and libext2fs2 packages installed match the
  other packages built from e2fsprogs so that modifications to those
  libraries (e.g. project quota) are available.

  Test-Parameters: clientdistro=sles12sp2 mdsdistro=sles12sp2 ossdistro=sles12sp2

  Change-Id: Idc22a029a6950cc1ffb9b6e44181d345db3ebbe5
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
  Reviewed-on: https://review.whamcloud.com/27834
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I783d58bd78d7c4c66cc85ec5557ae1aaf64016ba

5 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.

Change-Id: Ia12d193ff1a9c5a40cee2585a9bc47d5f9f63f4d
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 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
bs complicated by the fact that SLES and RHEL have different splits.

Change-Id: Iab8f75a7f7bd9790899a2024d91079d55501ef65
Signed-off-by: Girish Shilamkar <girish.shilamkar@sun.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 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>
5 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 Lustre-specific build version to distinguish packages from
upstream packages.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 years agoUpdate release notes, etc., for the 1.44.3 release debian/1.44.3-1 v1.44.3
Theodore Ts'o [Tue, 10 Jul 2018 05:40:38 +0000 (01:40 -0400)]
Update release notes, etc., for the 1.44.3 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: update standards version to 4.1.5
Theodore Ts'o [Tue, 10 Jul 2018 05:14:26 +0000 (01:14 -0400)]
debian: update standards version to 4.1.5

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: install hashmap.h since it is needed by libext2fs.h
Theodore Ts'o [Sun, 8 Jul 2018 15:52:53 +0000 (11:52 -0400)]
libext2fs: install hashmap.h since it is needed by libext2fs.h

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoUpdate release notes, etc., for the 1.44.3-rc2 release v1.44.3-rc2
Theodore Ts'o [Wed, 4 Jul 2018 13:46:45 +0000 (09:46 -0400)]
Update release notes, etc., for the 1.44.3-rc2 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Wed, 4 Jul 2018 13:11:41 +0000 (09:11 -0400)]
po: update uk.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Wed, 4 Jul 2018 13:11:41 +0000 (09:11 -0400)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Wed, 4 Jul 2018 13:11:41 +0000 (09:11 -0400)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Wed, 4 Jul 2018 13:11:40 +0000 (09:11 -0400)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Wed, 4 Jul 2018 13:11:40 +0000 (09:11 -0400)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: call fsync(2) to clear stale errors for a new a unix I/O channel
Theodore Ts'o [Wed, 4 Jul 2018 04:23:10 +0000 (00:23 -0400)]
libext2fs: call fsync(2) to clear stale errors for a new a unix I/O channel

Newer versions of Linux will retain errors and allow them to be
returned by fsync() or close(), even if the error happened before the
file descriptor was opened.  This was to accomodate Postgres's
"interesting" method of error collection.

Unfortunately, for e2fsck, we never want to see stale errors, as this
can cause xfstests (such generic/347) to fail with a false positive.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: fix kernel compat functions to use kernel error return conventions
Theodore Ts'o [Wed, 4 Jul 2018 04:18:30 +0000 (00:18 -0400)]
e2fsck: fix kernel compat functions to use kernel error return conventions

Fix journal_bmap() and sync_blockdev() to use the kernel error
convetions (e.g., -EIO instead of EIO) since they are called by
reovery.c, which is shared userspace / kernel code.

Without this, e2fsck might print an error message like this:

/sbin/e2fsck: Unknown code ____ 251 while recovering journal of /dev/mapper/thin-vol

instead of what it should have printed which was this:

/sbin/e2fsck: Input/output error while recovering journal of /dev/mapper/thin-vol

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: make generated test scripts read-only
Andreas Dilger [Mon, 2 Jul 2018 21:06:32 +0000 (17:06 -0400)]
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.

Change-Id: I60d417b816b7c559b5e05baf4167fc2cf2a871cf
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: if user declines to fix s_inodes_acount, abort
Theodore Ts'o [Fri, 29 Jun 2018 15:35:58 +0000 (11:35 -0400)]
e2fsck: if user declines to fix s_inodes_acount, abort

A recent commit, d74eb7ef: "e2fsck: handle s_inodes_count corruption
properly" tries to fix s_inodes_count.  However, if the user declines
to fix the invalid s_inodes_count, e2fsck needs to abort since
otherwise we can crash due to the insane s_inodes_count.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: do not allow initialized blocks pass i_size
Lukas Czerner [Thu, 28 Jun 2018 13:59:09 +0000 (15:59 +0200)]
e2fsck: do not allow initialized blocks pass i_size

We do not allow initialized blocks to exist past i_size as this could
lead to stale data exposure.

Remove test f_pgsize_gt_blksize because it is testing for the scenario
that not allowed. f_eofblocks is already testing for this.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: fix hang in readahead code if last block in fs is metadata
Theodore Ts'o [Thu, 28 Jun 2018 15:10:58 +0000 (11:10 -0400)]
e2fsck: fix hang in readahead code if last block in fs is metadata

If the last block the file system is metadata (very rare, but it can
happen, especially if e2fsck needs to relocate a bitmap block), e2fsck
will hang while trying to do readahead.

This problem was reported by Adam Buchbinder.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: e2fsdroid and mke2fs are dynamic executable in recovery partition
Jiyong Park [Wed, 20 Jun 2018 05:21:54 +0000 (14:21 +0900)]
AOSP: e2fsdroid and mke2fs are dynamic executable in recovery partition

The two utilities are now converted to dynamic executables as shared
libraries are supported in recovery mode.

As part of the conversion, shared libraries that are depended from them
are also marked as recovery_available: true.

Bug: 79146551
Test: adb reboot recovery, and select 'Wipe data/factory reset'. The
data partition is formatted and there is no selinux denial.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: I22fbc83a4ff0496096efca90721b0db1237c32cd
From AOSP commit: df1f088849ed3336bb4f6f200c29b30682f15948

5 years agotests, mke2fs: add option to suppress xattr copying to fix f_extent_htree
Theodore Ts'o [Tue, 26 Jun 2018 19:21:28 +0000 (15:21 -0400)]
tests, mke2fs: add option to suppress xattr copying to fix f_extent_htree

If the developer is running with SELinux enabled on /tmp, the
f_extent_htree regression test will fail because mke2fs by default
copies the extended attributes into the newly created file system (if
a directory hierarchy is specified via the -d option).

Fix this by adding a new extended option to mke2fs, -E no_copy_xattrs
and using it in f_extent_htree's test script.

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: explicitly force resize2fs's use of lazy (or not)
Theodore Ts'o [Tue, 26 Jun 2018 13:59:19 +0000 (09:59 -0400)]
tests: explicitly force resize2fs's use of lazy (or not)

Resize2fs will not enable lazy_itable if the kernel apparently does
not support that feature.  This will cause spurious test failures when
the tests are running on such a system (or where sysfs is not
mounted).

So for the purposes of the regression test we need to force the use of
lazy_itable so that the results conform to expected golden output.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebugfs: fix mknod command on some 32-bit platforms due to LFS
Theodore Ts'o [Tue, 26 Jun 2018 13:02:46 +0000 (09:02 -0400)]
debugfs: fix mknod command on some 32-bit platforms due to LFS

On some platforms the layout of struct stat changes if
_FILE_OFFSET_BITS is set to 64 (which force the use of 64-bit types
and 64-bit variants for system calls such as stat, lseek, etc.)

This is not true (mercifully) on i386, but it is true for the 32-bit
mips platform on Linux.  This caused debugfs's mknod command to fail,
since it used struct stat to pass the desired st_mode and st_rdev
fields for the to-be-created device file or FIFO, and this would be
different for create_inode.c and debugfs.c.

Linking together different object files together compiled with
different values of _FILE_OFFSET_BITS is perilous, but for now, let's
fix the specific problem by passing the two fields in the stat
structure that we really care about.  This fixes two regression tests
on the 32-bit MIPS platform: d_special_files and r_move_itable.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoUpdate release notes, etc., for the 1.44.3-rc1 release v1.44.3-rc1
Theodore Ts'o [Mon, 25 Jun 2018 14:16:38 +0000 (10:16 -0400)]
Update release notes, etc., for the 1.44.3-rc1 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoUpdate Makefile.in files using "make depend"
Theodore Ts'o [Mon, 25 Jun 2018 14:10:39 +0000 (10:10 -0400)]
Update Makefile.in files using "make depend"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: update libext2fs.symbol to reflect new hashmap functions
Theodore Ts'o [Mon, 25 Jun 2018 14:04:12 +0000 (10:04 -0400)]
debian: update libext2fs.symbol to reflect new hashmap functions

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: update standards version to 4.1.4
Theodore Ts'o [Mon, 25 Jun 2018 14:03:20 +0000 (10:03 -0400)]
debian: update standards version to 4.1.4

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: fix up f_detect_junk and f_detect_xfs
Theodore Ts'o [Mon, 25 Jun 2018 13:43:18 +0000 (09:43 -0400)]
tests: fix up f_detect_junk and f_detect_xfs

The golden output files for these two tests were out of date.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoresize: remove calculation of unused variable
Theodore Ts'o [Mon, 25 Jun 2018 01:27:42 +0000 (21:27 -0400)]
resize: remove calculation of unused variable

Fix-Coverty-Bug: 1398367
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebugfs: suppress spurious "checksum errors" message for unrelated failures
Theodore Ts'o [Mon, 25 Jun 2018 01:21:49 +0000 (21:21 -0400)]
debugfs: suppress spurious "checksum errors" message for unrelated failures

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: only retry to open the file system when the superblock is corrupt
Theodore Ts'o [Mon, 25 Jun 2018 01:09:59 +0000 (21:09 -0400)]
e2fsck: only retry to open the file system when the superblock is corrupt

Previously we were always retrying the ext2fs_open2() call with the
EXT2_FLAG_IGNORE_SB_ERRORS flag.  It only makes sense to do this if
the superblock is reported as corrupt.  Otherwise, it's a waste of
time, and results in printing an extra set of error messages to annoy
the user.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe4crypt: remove unneeded stat(2) call in do_get_policy()
Theodore Ts'o [Sun, 24 Jun 2018 23:28:13 +0000 (19:28 -0400)]
e4crypt: remove unneeded stat(2) call in do_get_policy()

We don't need to conditionally use O_DIRECTORY when opening a
directory.  Remove the unneeded stat, and a TOCTOU complaint from
Coverity.

Fixes-Coverity-Bug: 1293497
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: fix i_qcow test to properly test e2image's qcow-to-raw functionality
Theodore Ts'o [Sun, 24 Jun 2018 22:30:50 +0000 (18:30 -0400)]
tests: fix i_qcow test to properly test e2image's qcow-to-raw functionality

The test script was not properly checking e2image's ability to convert
a qcow2 image back to a raw image.  Fix this, and also change it to
use /tmp for the temporary files to speed things up systems with a
ramdisk for /tmp.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2image, libext2fs: check for corrupted qcow2 image
Theodore Ts'o [Sun, 24 Jun 2018 18:52:03 +0000 (14:52 -0400)]
e2image, libext2fs: check for corrupted qcow2 image

If the qcow2 image is corrupted, qcow2_write_image() will now return
an indication of this to e2image (the only current user of
qcow2_write_image).

Also fix how e2image prints an error message it can't understand the
qcow2 image.

Addresses-Coverity-Bug: 1297511
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: explicitly ignore a possible unlink failure in ext2fs_free_icount
Theodore Ts'o [Sun, 24 Jun 2018 18:32:15 +0000 (14:32 -0400)]
libext2fs: explicitly ignore a possible unlink failure in ext2fs_free_icount

There's not much we can do if the unlink of the tdb file fails, and we
don't want to print a warning message from a library.

Fixes-Coverity-Bug: 1308364
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: add error-checking when unlink tdb file for dir_info
Theodore Ts'o [Sun, 24 Jun 2018 18:00:14 +0000 (14:00 -0400)]
e2fsck: add error-checking when unlink tdb file for dir_info

Fixes-Coverity-Bug: 1308365
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomke2fs: add proper error checking in write_reserved_inodes
Theodore Ts'o [Sun, 24 Jun 2018 17:54:58 +0000 (13:54 -0400)]
mke2fs: add proper error checking in write_reserved_inodes

Fixes-Coverity-Bug: 1369034
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: add proper error checking in move_quota_inode
Theodore Ts'o [Sun, 24 Jun 2018 17:52:10 +0000 (13:52 -0400)]
e2fsck: add proper error checking in move_quota_inode

Fixes-Coverity-Bug: 1369035
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2image: Add an assertion/sanity check in initialize_qcow2_image()
Theodore Ts'o [Sun, 24 Jun 2018 05:04:48 +0000 (01:04 -0400)]
e2image: Add an assertion/sanity check in initialize_qcow2_image()

This is mostly to shut up some coverity warnings, but in theory
fs->blocksize could have been corrupted outside of this function...

Fixes-Coverity-Bug: 1297492
Fixes-Coverity-Bug: 1297490
Fixes-Coverity-Bug: 1297488
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebugfs: avoid undefined bit shift in parse_uint()
Theodore Ts'o [Sun, 24 Jun 2018 04:39:37 +0000 (00:39 -0400)]
debugfs: avoid undefined bit shift in parse_uint()

The case is one that should never happen (and indicates a bug if it
does), but in that case, we should still avoid an undefiniced C
expression.

Fixes-Coverity-Bug: 1297494
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2image: calculate progress rate using floating point
Theodore Ts'o [Sun, 24 Jun 2018 04:32:51 +0000 (00:32 -0400)]
e2image: calculate progress rate using floating point

One of the divisions used when caluclate the progress rate was being
done as an integer instead of floating-point operation.  This could
cause the end result to not be as accurate as we would like.

Fixes-Coverity-Bug: 1297513
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe4crypt: fix invalid errno comparison with a negative error code
Theodore Ts'o [Sun, 24 Jun 2018 04:25:14 +0000 (00:25 -0400)]
e4crypt: fix invalid errno comparison with a negative error code

Fixes-Coverity-Bug: 1292755
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: e2fsdroid: Correctly process the root inode
Luis Hector Chavez [Tue, 19 Jun 2018 21:50:40 +0000 (14:50 -0700)]
AOSP: e2fsdroid: Correctly process the root inode

This change ensures that the root inode has the correct uid/gid by
calling androidify_inode() on it. It also sets android_configure = 1
when the u/gid mapping is provided.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Google-Bug-Id: 78561186
Google-Bug-Id: 110415537
Test: $ m  # With BOARD_SYSTEMIMAGE_UID_MAP=655360 0 5000
      $ simg2img ${OUT}/{system.img,system.raw.img}
      $ mkdir tmp
      $ sudo mount -o loop ${OUT}/system.raw.img tmp
      $ stat --format="%u %g" tmp
      655360 655360
Change-Id: I842a32b6d64439f9f16b9c6b66de20d4e4418aa8
From AOSP commit: ee3f0f37c34d68aa7a96a36dea369acae312772c

5 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Sun, 24 Jun 2018 03:14:14 +0000 (23:14 -0400)]
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoFix gcc and clang warnings
Theodore Ts'o [Sun, 24 Jun 2018 03:00:50 +0000 (23:00 -0400)]
Fix gcc and clang warnings

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: remove c99 idiom to fix build
Eric Sandeen [Sat, 23 Jun 2018 22:04:19 +0000 (18:04 -0400)]
libext2fs: remove c99 idiom to fix build

hashmap.c: In function ‘ext2fs_hashmap_free’:
hashmap.c:72:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (size_t i = 0; i < h->size; ++i) {
  ^
hashmap.c:72:2: note: use option -std=c99 or -std=gnu99 to compile your code
make[2]: *** [hashmap.o] Error 1

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: fix f_bigalloc_orphan_list so it is not dependant on umask
Theodore Ts'o [Sat, 23 Jun 2018 21:54:28 +0000 (17:54 -0400)]
tests: fix f_bigalloc_orphan_list so it is not dependant on umask

Reported-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: mark device inodes with EXT4_EXTENTS_FL bad
Andreas Dilger [Sat, 23 Jun 2018 21:33:58 +0000 (17:33 -0400)]
e2fsck: mark device inodes with EXT4_EXTENTS_FL bad

Mark device inodes bad if they have the EXT4_EXTENTS_FL set, since
this should never happen and likely shows the inode is corrupt.

Change-Id: I85ab667b39ff57c658a779e59f692a080217690e
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: PAGE_SIZE larger than blocksize with hole
Andreas Dilger [Sat, 23 Jun 2018 20:26:41 +0000 (16:26 -0400)]
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().

The f_eofblocks thest checks quite the same situation, but for broken
file system. This test is about correct file.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: handle preallocation for large PAGE_SIZE
Andreas Dilger [Sat, 23 Jun 2018 18:30:52 +0000 (14:30 -0400)]
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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibcom_err: handle error case when FD_CLOEXEC can't be set on debug FILE
Theodore Ts'o [Sat, 23 Jun 2018 03:21:34 +0000 (23:21 -0400)]
libcom_err: handle error case when FD_CLOEXEC can't be set on debug FILE

Fixes-Coverity-Bug: 1049142
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: simplify extent_fallocate()
Theodore Ts'o [Sat, 23 Jun 2018 03:05:49 +0000 (23:05 -0400)]
libext2fs: simplify extent_fallocate()

The goal_distance variable is used in only one place in the
extent_fallocate() function, so set it right before it is used, and
eliminate one assignment of goal_distance which is never used before
it gets overwritten.

Fixes-Coverity-Bug: 1307694
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibsupport: fix (very potential) NULL dereference
Theodore Ts'o [Sat, 23 Jun 2018 02:53:00 +0000 (22:53 -0400)]
libsupport: fix (very potential) NULL dereference

It's a very rare set of circumstances (requiring deleting profile
sections, which e2fsprogs doesn't do) that might trigger a NULL
derference, but fix it for robustness's sake, maybe some day someone
will use that functionality.

Fixes-Coverity-Bug: 207508
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: fix uninitialized variable dereference in extent_bmap()
Theodore Ts'o [Sat, 23 Jun 2018 02:33:39 +0000 (22:33 -0400)]
libext2fs: fix uninitialized variable dereference in extent_bmap()

The code path was failing to initialize the logial block number hint
in the allocation context.  It's not currently being used, but it
might be in the future, and it trips warnings in static code
analyzers.

Fixes-Coverity-Bug: 709545
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibsupport: fix memory leak in error path in quota_compute_usage()
Theodore Ts'o [Sat, 23 Jun 2018 02:20:51 +0000 (22:20 -0400)]
libsupport: fix memory leak in error path in quota_compute_usage()

Fixes-Coverity-Bug: 1362023
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: fix potential resource leak in ext2fs_file_write
Theodore Ts'o [Sat, 23 Jun 2018 01:57:40 +0000 (21:57 -0400)]
libext2fs: fix potential resource leak in ext2fs_file_write

If EXT2_FLAG_SHARE_DUP is set, and ext2fs_bmap2() fails, it's possible
that we will leak the allocated memory in new_block.

Fixes-Coverity-Bug: 1437473
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomisc: add e2mmpstatus utility via dumpe2fs
Shuichi Ihara [Wed, 2 May 2018 04:26:06 +0000 (22:26 -0600)]
misc: add e2mmpstatus utility via dumpe2fs

e2mmpstatus is a Multi-Mount Protection (MMP) helper utility to read
an MMP block to see if it is being updated.  It can also output the
latest update time, nodename, and device from the MMP block.

This is useful for HA and other maintenance scripts to determine if
the filesystem is in use on another node, and which node it is.

Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Moved e2mmpstatus checking/dumping code to be part of dumpe2fs rather
than a standalone program, using the "-m" option to check MMP status,
and "-i" to dump info.  If dumpe2fs is called as "e2mmpstatus" (and
also "mmpstatus" for compatibility reasons), assume "-m" is specified.

Re-use the existing MMP block handing routines (with some changes) to
check and dump the MMP block, rather than adding duplicate versions.

Modify dumpe2fs to exit with a non-zero error code if there is an
error while reading the filesystem metadata or MMP block, or if
"-m" is used with the "mmp" feature and is in use by another node.

Add a configure check for gethostname() rather than depending on
_BSD_SOURCE or _XOPEN_SOURCE to be set.

Update the f_mmp, m_mmp, m_mmp_bad_csum, and m_mmp_bad_magic tests
to use e2mmpstatus to check and dump the MMP state before and after
e2fsck is run to verify that the tool is working correctly.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: set dir_nlink feature if large dir exists
Andreas Dilger [Fri, 22 Jun 2018 22:08:54 +0000 (18:08 -0400)]
e2fsck: set dir_nlink feature if large dir exists

If there is a directory with more than EXT2_LINK_MAX (65000)
subdirectories, but the DIR_NLINK feature is not set in the
superblock, the feature should be set before continuing on
to change the on-disk directory link count to 1.

While most filesystems should have DIR_NLINK set (it was set
by default for all ext4 filesystems, and all kernels between
2.6.23 and 4.12 automatically set it if the directory link
count grew too large), it is possible that this flag is lost
due to disk corruption or for an upgraded filesystem.  We no
longer want kernels to automatically enable features.

Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=196405
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: remove pre-generated f_extent_htree image
Andreas Dilger [Fri, 22 Jun 2018 21:54:50 +0000 (17:54 -0400)]
tests: remove pre-generated f_extent_htree image

The f_extent_htree test depends on the "mke2fs -d" functionality
that did not exist in the maint branch when the patch was landed.
On master this functionality exists and should be used instead of
a pre-generated image.  That exercises the "mke2fs -d" functionality
as well as e2fsck better.

[ Fixed to add missing expect.pre.? files --tytso ]

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: don't run sed multiple times on test output
Andreas Dilger [Wed, 2 May 2018 04:26:03 +0000 (22:26 -0600)]
tests: don't run sed multiple times on test output

Don't call sed multiple times on the output, and avoid the use
of temporary files, or if possible.  It would be convenient to
use "sed -i" to only update the output file once, but this is
not portable to all platforms.

[ Fixed a few test regression failures --tytso ]

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: remove redundant sed filtering
Andreas Dilger [Wed, 2 May 2018 04:26:02 +0000 (22:26 -0600)]
tests: remove redundant sed filtering

Now that the majority of device name filtering is in filter.sed,
it does not need to be specified explicitly for every test.

Fix the error message printed in debugfs when opening the device
to match that used in other tools.  This simplifies the filtering,
and will be helpful if debugfs messages are internationalized.

[ Fixed up some test failures in m_hugefile t_uninit_bg_rm --tytso ]

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoext2fs: annotate superblock/inode offsets
Andreas Dilger [Fri, 22 Jun 2018 16:37:12 +0000 (12:37 -0400)]
ext2fs: annotate superblock/inode offsets

Add byte offsets for the fields in ext2_super_block and ext2_inode
for convenience when debugging on-disk structures.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: clean up $DEBUGFS_EXE usage in scripts
Andreas Dilger [Fri, 22 Jun 2018 15:43:54 +0000 (11:43 -0400)]
tests: clean up $DEBUGFS_EXE usage in scripts

Instead of putting the entire test script under an implicit
"if test -x $DEBUGFS_EXE" conditional (sometimes indenting
the code, and sometimes not), rather check for the reverse
and exit the test script early if $DEBUGFS_EXE is missing.

In some places, tests were running $DEBUGFS_EXE directly,
when they should be running $DEBUGFS (which will run with
Fortify, or other options).

[ Fixed up missing exit statement in f_detect_junk. --tytso ]

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: don't unlink test image if SKIP_UNLINK set
Andreas Dilger [Fri, 22 Jun 2018 15:42:41 +0000 (11:42 -0400)]
tests: don't unlink test image if SKIP_UNLINK set

Don't register a trap to unlink $TMPFILE at the test exit if
SKIP_UNLINK is set.  Otherwise, this makes it difficult to
debug a failing test.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: don't use a sparse test file
Andreas Dilger [Fri, 22 Jun 2018 15:42:14 +0000 (11:42 -0400)]
tests: don't use a sparse test file

If the TEST_BITS file is sparse, then the "debugfs -R write"
command may skip holes in the file when copying it into the
test image (depending on whether SEEK_HOLE/SEEK_DATA and/or
FIEMAP are available in the copy_file() function).

This was causing test failures on MacOS in the f_dup_resize
and d_loaddump tests because the TEST_BITS file was the
compiled "debugfs" binary, which apparently has holes when
built on MacOS, and the number of blocks allocated in the
test image was reduced as a result.  This caused the expect
output to differ in the summary line and resulted in failure.

Instead of using the debugfs binary for TEST_BITS, generate
a temporary file using /dev/urandom, if available.  If not,
fall back to the old behaviour or using debugfs.

[ Fixed up use of non-POSIX /bin/sh constructs and add test_data.tmp to
  .gitignore and files to be deleted on a make clean. --tytso ]

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: don't corrupt an blkmap64_rb when marking a range of size zero
Theodore Ts'o [Fri, 22 Jun 2018 14:46:52 +0000 (10:46 -0400)]
libext2fs: don't corrupt an blkmap64_rb when marking a range of size zero

Calling ext2fs_mark_block_bitmap_range2() with a count of zero can end
up corrupting the red-black block bitmap structure, since a an entry
in the rbtree with zero-length extent can end up causing the
find_first_{zero,set} operations to return incorrect results.

This was found by Adam Buchbinder, who created a fuzzed file system
using which AFL that caused e2fsck to hang in an infinite loop in in
e2fsck's readahead code.

Added a regression test to detect this failure.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agofilefrag: don't ignore fsync errors
Lukas Czerner [Thu, 21 Jun 2018 13:19:56 +0000 (15:19 +0200)]
filefrag: don't ignore fsync errors

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: Mark as recovery_available:true
Jiyong Park [Thu, 24 May 2018 05:07:52 +0000 (14:07 +0900)]
AOSP: Mark as recovery_available:true

Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. adbd) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Google-Bug-Id: 79146551
Test: m -j
Change-Id: I9db889c15e1f563a1e3f4e7dc5b630d19e3cf4c0
From AOSP commit: 4a9d5f4211818c70a1b2414e3774197386b7f245

5 years agoAOSP: e2fsck: imply -f when using -E unshare_blocks
David Anderson [Fri, 11 May 2018 20:34:34 +0000 (13:34 -0700)]
AOSP: e2fsck: imply -f when using -E unshare_blocks

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Google-Bug-Id: 64109868
Test: e2fsck -E unshare_blocks does a full scan
Change-Id: Idc36ceba3bf24e1fb1487feedefe9a68f9acc7f3
From AOSP commit: 7c180d6598363722de6195d142d7677bbc2b0161