Whamcloud - gitweb
tools/e2fsprogs.git
4 years agoLU-12204 mke2fs: fix check for absurdly large devices 62/34762/4 v1.44.5.wc1-lustre
Andreas Dilger [Thu, 25 Apr 2019 21:42:58 +0000 (23:42 +0200)]
LU-12204 mke2fs: fix check for absurdly large devices

The check in mke2fs is intended to be for the number of blocks in the
filesystem exceeding the maximum number of addressable blocks in 2^32
bitmaps, which is (2^32 * 8 bits/byte * blocksize) = 2^47 blocks,
or 2^59 bytes = 512PiB for the common 4KiB blocksize.

However, s_log_blocksize holds log2(blocksize_in_kb), so the current
calculation is a factor of 2^10 too small.  This caused mke2fs to fail
while trying to format a 900TB filesystem.

Fixes: 101ef2e93c25 ("mke2fs: Avoid crashes / infinite loops for absurdly large devices")
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Change-Id: If6881e19c28d0c98848b9b4ede65b11d81dcab07
Reviewed-on: https://review.whamcloud.com/34762
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
4 years ago LU-12158 mke2fs: avoid too large stride and stripe_width 67/34767/4
Wang Shilong [Tue, 21 May 2019 04:06:39 +0000 (12:06 +0800)]
 LU-12158 mke2fs: avoid too large stride and stripe_width

According to benchmarks numbers, too large stripe and stripe_width
will make preassure with ext4 mballoc allocater and hurts performances
finally.
                    2MB Chunk size                 256K Chunk size
stripe_width,stride     Write(MB/s)    Read(MB/s)   Write(MB/s) Read(MB/s)
512,512                 10,810         10,124       10,492      6,923
1024,1024               10,793         10,064       10,431      6,921
2048,2048               8,047          10,080       6,629       7,381
4096,4096               7,350          10,089       6,505       7,282

Performance number comes from Shuichi Ihara.

This patch try to avoid use too large stride and stripe_width when mkfs.
If users really want large value they could do it by specify mkfs options
or run tune2fs later.

Change-Id: I768f1ecb39837338e08842b21b4fca8b98165d2a
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/34767
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
4 years agoLU-11882 e2fsck: zero date is not inode badness 13/34113/2
Artem Blagodarenko [Fri, 25 Jan 2019 16:35:24 +0000 (19:35 +0300)]
LU-11882 e2fsck: zero date is not inode badness

Lustre FS OST has some precreated objects which have zeroed
creation time. e2fsck adds badness points for such inodes.
If OST has many precreated objects, e2fsck spends too much time
during phase2, because processes each of such inode.

Let's allow Lustre FS inode has zeroed time field for
precreated objects.

Change-Id: I171a0fe741449ca99b29b5af51032a7b4c716344
Cray-bug-id: LUS-6857
Signed-off-by: Artem Blagodarenko <c17828@cray.com>
Reviewed-on: https://review.whamcloud.com/34113
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
5 years agoLU-11609 mke2fs: allow 64bit feature without extents 97/33897/2 v1.44.5.wc1
Andreas Dilger [Sat, 3 Nov 2018 09:10:22 +0000 (03:10 -0600)]
LU-11609 mke2fs: allow 64bit feature without extents

The 64bit feature should be allowed without extents to for 32-bit
metadata_csum checksums to be stored in the group descriptor.
Change the extents check to check for more than 2^32 blocks instead
of the 64bit feature flag.  This also avoids warnings later if the
metadata_csum feature is enabled on a filesystem without 64bit.

Consolidate repeated 64bit feature checks into one check.

The fs_blocks_count value is always set when parse_fs_type() is
called, so no need to check if it is zero.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ie73ff0ed50cfed5d6a9596260c6b6dc32d3ebbe5
Reviewed-on: https://review.whamcloud.com/33897
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
5 years agodebugfs: output large directory size
Artem Blagodarenko [Fri, 14 Dec 2018 07:50:54 +0000 (10:50 +0300)]
debugfs: output large directory size

large_dir option allows to create directory with size > 2GB.
debugfs utility outputs negative size value for large directories
and ignores high part of directory size.

Fix debugfs to use high part of directory size in debugfs output
and use appropriate output format.

Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
5 years agoe2fsck: allow to check >2GB sized directory
Artem Blagodarenko [Fri, 14 Dec 2018 07:50:53 +0000 (10:50 +0300)]
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.

Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
5 years agoLU-11215 libe2p: add large_xattr as an alias of ea_inode
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 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.

Since e2fsprogs release 1.44.4 the Version in e2fsprogs.spec
is not generated anymore. However contrib/build-rpm still relies
on the Version from the spec, maintain the version in the spec
as well.

e2fsprogs commit: e5f0f3eebef7b483d5cc8b37023d6e0256776d94

Change-Id: I4a31e659ff4d98f9bb00fea731bd1ee59a55fd38
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
5 years agoUpdate release notes, etc., for the 1.44.5 release v1.44.5
Theodore Ts'o [Sun, 16 Dec 2018 04:05:58 +0000 (23:05 -0500)]
Update release notes, etc., for the 1.44.5 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: create changelog for v1.44.5
Theodore Ts'o [Sat, 15 Dec 2018 18:15:10 +0000 (13:15 -0500)]
debian: create changelog for v1.44.5

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: fix up libext2fs-dev.doc-base
Theodore Ts'o [Sun, 16 Dec 2018 04:21:58 +0000 (23:21 -0500)]
debian: fix up libext2fs-dev.doc-base

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: ODR violation in tune2fs during host build
Mark Salyzyn [Thu, 25 Oct 2018 20:00:51 +0000 (13:00 -0700)]
AOSP: ODR violation in tune2fs during host build

Port of commit 3271c69c97f486914fea833a36eaf5d86938c76d as applied to
e2fsck, but to tune2fs.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 112062612
Bug: 111302946
Test: $ m SANITIZE_HOST=address out/host/linux-x86/bin/tune2fs
      $ out/host/linux-x86/bin/tune2fs --help
Change-Id: If49d367d96b7bfd0b8b79c6bde23c0ded52ca683
From AOSP commit: 1cb5de330e5d1e0c6f587945ec065b995cc1c84b

5 years agoe2fsck: use "Optimize?" prompt for PR_1E_CAN_{COLLAPSE,NARROW}_EXTENT_TREE
Theodore Ts'o [Sun, 16 Dec 2018 03:13:41 +0000 (22:13 -0500)]
e2fsck: use "Optimize?" prompt for PR_1E_CAN_{COLLAPSE,NARROW}_EXTENT_TREE

If e2fsck can optimize an inode's extent tree, it should ask for
permission to optimize it, not to "fix" it.  This was causing some
confusion, since some users interpreted this prompt as an indication
that the file system was inconsistent.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: update to Debian policy 4.2.1
Theodore Ts'o [Sat, 15 Dec 2018 17:05:16 +0000 (12:05 -0500)]
debian: update to Debian policy 4.2.1

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe4defrag: use 64-bit counters to track # files defragged
Theodore Ts'o [Sat, 15 Dec 2018 15:08:42 +0000 (10:08 -0500)]
e4defrag: use 64-bit counters to track # files defragged

Addresses-Debian-Bug: 888899

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomisc: fix groff formatting nits in man pages
Bjarni Ingi Gislason [Tue, 11 Dec 2018 01:49:22 +0000 (01:49 +0000)]
misc: fix groff formatting nits in man pages

Change a two-fonts macro to a one-font one, when there is only one
genuine argument.

Separate a punctuation mark or a section number from the only argument
to make two for a two-fonts macro.

Remove an unneeded escape in front of a horizontal tab character.

Correct the unit for distance from 'in' to 'i'.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: fix location of libext2fs documentation
Theodore Ts'o [Wed, 12 Dec 2018 03:20:52 +0000 (22:20 -0500)]
debian: fix location of libext2fs documentation

Addresses-Debian-Bug: #915942
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: fix regression so we are correctly translating Posix ACL's
Theodore Ts'o [Fri, 7 Dec 2018 03:44:45 +0000 (22:44 -0500)]
libext2fs: fix regression so we are correctly translating Posix ACL's

The commit 50d0998cfee ("libext2fs: add ea_inode support to set
xattr") broke the fix that was addressed in commit 0ee1eaf70c25
("libext2fs: translate internal ext4 acl to Posix ACL in
ext2fs_xattr_[sg]et()").  This was because although we calculated what
the correct on-disk ACL representation would be, we didn't actually
*store* it, but instead stored the passed-in Posix ACL memory
representation instead.

Addresses-Launchpad-Bug: #1807288
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2freefrag: fix free blocks count during live scan
Darrick J. Wong [Thu, 8 Nov 2018 18:44:31 +0000 (10:44 -0800)]
e2freefrag: fix free blocks count during live scan

In e2freefrag live scan mode, we take the free block count from the
ondisk superblock.  This leads to screwy histogram percentages:

Extent Size Range :  Free extents   Free Blocks  Percent
    4M...    8M-  :             5          8234    1.05%
   64M...  128M-  :             2         52279    6.64%
  512M... 1024M-  :             1        202752   25.74%

...because there could be superblock updates in the journal that haven't
yet been checkpointed.  The online scan is perfectly capable of tallying
the free blocks on its own, so teach it do that and make a more accurate
report.

Reported-by: Elana Hashman <Elana.Hashman@twosigma.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotune2fs: fix false warning that a UUID change will take a long time
Theodore Ts'o [Sat, 24 Nov 2018 03:34:31 +0000 (22:34 -0500)]
tune2fs: fix false warning that a UUID change will take a long time

If the file system only has the flex_bg feature enabled (with out the
metadata_csum feature enabled), it won't take a long time time fix up
the checksums after changing the UUID.  While it does need to
recalculate all of the checksums in the block group descriptors, that
doesn't take a long time.

Also, if the ea_data feature is enabled, changing the UUID will also
take a long time, and we weren't warning the user about that case.

Fix up the warning message so it doesn't mislead people, and is more
accurate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomk_cmds: don't use explicit pathname for sed
Theodore Ts'o [Thu, 22 Nov 2018 23:01:56 +0000 (18:01 -0500)]
mk_cmds: don't use explicit pathname for sed

$AWK doesn't use an explicit pathname, and it's perfectly fine to
assume that awk and sed are in the user's PATH.  The problem with
using an explicit pathname is that Debian currently allows merged and
non-merged /usr.  Avoid using an explicit pathname to prevent
potential problems.

Addresses-Debian-Bug: #914087
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: check xattr 'system.data' before setting inline_data feature
Li Dongyang [Tue, 13 Nov 2018 04:46:03 +0000 (15:46 +1100)]
e2fsck: check xattr 'system.data' before setting inline_data feature

ext2fs_inline_data_size will happy return 0 and set size to
EXT4_MIN_INLINE_DATA_SIZE even when inode doesn't have
xattr 'system.data', a corrupted i_flags could make e2fsck
enable the inline_data on the superblock.

We should only offer to enable inline_data when i_flags is set
and xattr 'system.data' can be found.

Also use correct prompt for PR_1_INLINE_DATA_FEATURE.

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
5 years agoe4defrag: handle failure to open the file system gracefully
Theodore Ts'o [Sun, 21 Oct 2018 11:35:53 +0000 (07:35 -0400)]
e4defrag: handle failure to open the file system gracefully

If e4defrag is run by root, it will try to open the underlying file
system for files that it is trying to defrag so it can get the file
system parameters.  It's currently doing this by searching /etc/mtab.
This isn't the best way to go about doing things, but we'll leave it
for now, at least for a maintenance release.  (The better way to do
things would be to look up the device using the blkid library, but
that's a more involved change.)

Since the file system parameters isn't strictly speaking necessary
(after all we get by without them when not running as root), we'll
allow e4defrag to continue running if we can't find the file system.
This can happen if /etc/mtab is pointing at /proc/mounts, and the
kernel can't properly identify the root file system, it is reported as
"/dev/root".

Addresses-Debian-Bug: #907634

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: move inode and its interior extent tree block
Theodore Ts'o [Sat, 20 Oct 2018 14:11:21 +0000 (10:11 -0400)]
tests: move inode and its interior extent tree block

Add a test case for the bug fixed in 4b3038134baf: "resize2fs: update
checksums in the extent tree's relocated block"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoresize2fs: update checksums in the extent tree's relocated block
Theodore Ts'o [Sat, 20 Oct 2018 13:14:48 +0000 (09:14 -0400)]
resize2fs: update checksums in the extent tree's relocated block

When shrinking an file system, and we need to relocate an inode, the
checksums in its extent tree must get updated to reflect its new inode
number.  When doing this, we need to do this *after* we update the
extent tree to reflect any blocks which need to be relocated due to
the file system shrink operation.

Otherwise, in the case where only an interior node of the extent tree
needs to get relocated, and none of the entries in that node need to
be adjusted, the checksum for that interior node is updated in the old
copy of that block, and then after the extent tree is updated to use
the new copy of that interior node, the extent tree is left with an
invalid checksum.

This is a relatively rare case, since it requires the following
conditions to be true:

*)  The metadata checksum feature must be enabled.
*)  An inode needs to be relocated.
*)  The inode needs to have an interior node.
*)  The block for that interior node needs to be relocated.
*)  None of blocks addressed by entries in that interior node needs
    to be relocated.

When all of these conditions are true, though, the file system is left
with corrupted with bad checksum for the extent tree block.

Addresses-Launchpad-Bug: 1798562

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Jean-Baptiste Lallement <jean-baptiste.lallement@ubuntu.com>
5 years agofuse2fs: fix fsname option in some cases
Nicholas Clark [Tue, 16 Oct 2018 19:34:20 +0000 (15:34 -0400)]
fuse2fs: fix fsname option in some cases

FUSE's parser allows command-line options to be specified before
or after the device/image and mount-path. This commit changes the
value of the fsname mount option to be correct even if options are
specified before the target device/image.

Signed-off-by: Nicholas Clark <nicholas.clark@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoblkid: adjust copyright license for version.c to be LGPL
Theodore Ts'o [Tue, 16 Oct 2018 16:53:36 +0000 (12:53 -0400)]
blkid: adjust copyright license for version.c to be LGPL

This makes the license of version.c to be consistent with the rest of
the files in the library.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: android/perms.c: clean up error handling
Nick Kralevich [Thu, 11 Oct 2018 03:35:17 +0000 (20:35 -0700)]
AOSP: android/perms.c: clean up error handling

There are a number of error conditions which, due to the way
ext2fs_dir_iterate2 operates, would not be propagated to the upper
layers of the call stack. As a result, certain error conditions,
such as not having enough room to allocate blocks for SELinux
labels, would fail silently, instead of causing a compile
failure.

As suggested in
https://android-review.googlesource.com/c/platform/external/e2fsprogs/+/324363
, add a error field to the caller's private data structure, and use the
bit in the field to indicate an error condition. Now, certain errors
which were silently ignored will cause a compile failure when compiling
Android.

Test: Artifically modify selabel_lookup() to return a failure, and
      verify Android doesn't compile.
Test: Verify Android compiles under normal circumstances.
Test: Artifically modify ino_add_xattr() to return a failure, and
      verify Android doesn't compile.
Bug: 117502873
Bug: 117567573
Bug: 117473440

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

5 years agoAOSP: Fix debugfs clang build.
David Anderson [Thu, 11 Oct 2018 19:36:34 +0000 (12:36 -0700)]
AOSP: Fix debugfs clang build.

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

5 years agoAOSP: ODR violation in resize2fs during host build
Jiyong Park [Tue, 18 Sep 2018 00:41:07 +0000 (09:41 +0900)]
AOSP: ODR violation in resize2fs during host build

Bug: 112062612
Test: $ m SANITIZE_HOST=address $OUT_DIR/host/linux-x86/bin/resize2fs $OUT_DIR/host/linux-x86/bin/llvm-symbolizer
      $ $OUT_DIR/host/linux-x86/bin/resize2fs

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

5 years agoe2fsck: clear clang warnings for missing field initializers in structs
Theodore Ts'o [Thu, 11 Oct 2018 14:25:31 +0000 (10:25 -0400)]
e2fsck: clear clang warnings for missing field initializers in structs

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotest_one: make sure the tmpfile is cleaned up if the test script exits
Theodore Ts'o [Thu, 11 Oct 2018 02:56:12 +0000 (22:56 -0400)]
test_one: make sure the tmpfile is cleaned up if the test script exits

f_detect_junk will skip the test by exiting; and in that case we need
to make sure the test's tmpfile gets cleaned up.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoDefine __GNUC_PREREQ if necessary
Theodore Ts'o [Thu, 11 Oct 2018 02:25:54 +0000 (22:25 -0400)]
Define __GNUC_PREREQ if necessary

The __GNUC_PREREQ convenience macro is defined by glibc's header
files.  If it isn't available, make it available for us to use.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agofilefrag.c: fix build problem when using musl libc
Theodore Ts'o [Thu, 11 Oct 2018 02:24:01 +0000 (22:24 -0400)]
filefrag.c: fix build problem when using musl libc

Use HAVE_LINUX_FD_H guard since not all libc's or operating systems
provide <linux/fd.h>.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibe2p: avoid segfault when s_nr_users is too high
Lukas Czerner [Tue, 14 Aug 2018 14:37:53 +0000 (16:37 +0200)]
libe2p: avoid segfault when s_nr_users is too high

Currently in e2fsprogs tools it's possible to access out of bounds
memory when reading list of ids sharing a journal log
(journal_superblock_t->s_users[]) in case where s_nr_users is too high.

This is because we never check whether the s_nr_users fits into the
restriction of JFS_USERS_MAX. Fix it by checking that nr_users is not
bigger than JFS_USERS_MAX and error out when possiblem.

Also add test for dumpe2fs. The rest would require involving external
journal which is not possible to test with e2fsprogs test suite at the
moment.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoFor --enable-subset, change "make install" so it implies "make install-libs"
Theodore Ts'o [Fri, 24 Aug 2018 21:12:20 +0000 (17:12 -0400)]
For --enable-subset, change "make install" so it implies "make install-libs"

The e2fsprogs-libs-1.44.x.tar.gz subset distribution had a hack so
that "make install" would install the libraries via an implied "make
install-libs" --- since after all the tarball had was just the
libraries.

This commit makes "make install" behave the same was as the
e2fsprogs-libs distribution in the case of "configure --enable-subset"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: update changelog for 1.44.4-2 release
Theodore Ts'o [Tue, 21 Aug 2018 15:32:30 +0000 (11:32 -0400)]
debian: update changelog for 1.44.4-2 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: remove hard-coded dependency for libss2 in e2fsprogs.shlibs.local
Theodore Ts'o [Wed, 22 Aug 2018 20:33:10 +0000 (16:33 -0400)]
debian: remove hard-coded dependency for libss2 in e2fsprogs.shlibs.local

The hard-coded override is very old, and isn't necessary --- in fact,
it's actively harmful because we are using one or two symbols that
were added to libss2 after e2fsprogs 1.34.   So remove it.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: fix up libcom-err2's version dependency handling
Theodore Ts'o [Wed, 22 Aug 2018 18:55:22 +0000 (14:55 -0400)]
debian: fix up libcom-err2's version dependency handling

We renamed libcomerr2 to libcom-err2 in 1.43.9.  So generating
dependencies of the form libcom-err2 (>= 1.34) don't really make any
sense.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: update to debian policy 4.2.0
Theodore Ts'o [Wed, 22 Aug 2018 00:12:08 +0000 (20:12 -0400)]
debian: update to debian policy 4.2.0

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: create NEWS.gz in /usr/share/doc/e2fsprogs
Theodore Ts'o [Wed, 22 Aug 2018 00:10:02 +0000 (20:10 -0400)]
debian: create NEWS.gz in /usr/share/doc/e2fsprogs

Create the full NEWS.gz and put it in /usr/share/doc/e2fsprogs instead
of the RELEASE-NOTES file to comply with the Debian policy 4.2.0.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoFix "make install" for configure --enable-subset
Theodore Ts'o [Wed, 22 Aug 2018 17:42:23 +0000 (13:42 -0400)]
Fix "make install" for configure --enable-subset

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMake sure all release note files have a single trailing empty line
Theodore Ts'o [Wed, 22 Aug 2018 04:52:08 +0000 (00:52 -0400)]
Make sure all release note files have a single trailing empty line

This is needed so we can assemble a complete release notes file via a
command like:

cat $(/bin/ls -1 doc/RelNotes/v*.txt | tac) | gzip -9n > NEWS.gz

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2image: copy mmp block when create metadata only image
Artem Blagodarenko [Tue, 21 Aug 2018 19:58:41 +0000 (22:58 +0300)]
e2image: copy mmp block when create metadata only image

e2image in modes without data blocks copy (-r, -Q) doesn't copy
mmp block that leads to fsck error:

Superblock has invalid MMP magic.  Fix? no

This patch adds coping this block if mmp is enabled.

Change-Id: I66035ee394a0ff53b9959e82b3e47050f3bf1593
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: allow verity files to have initialized blocks past i_size
Eric Biggers [Tue, 21 Aug 2018 17:59:37 +0000 (10:59 -0700)]
e2fsck: allow verity files to have initialized blocks past i_size

Since ext4 verity is going to be an RO_COMPAT feature rather than an
INCOMPAT one, the on-disk i_size of verity inodes needs to be the data
size rather than the full size.  Consequently, verity inodes will have
initialized blocks past i_size, containing the Merkle tree and other
verity metadata.  So e2fsck must not fix the i_size of such inodes as it
normally would.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: add verity flag to EXT2_LIB_FEATURE_RO_COMPAT_SUPP
Eric Biggers [Tue, 21 Aug 2018 00:15:52 +0000 (17:15 -0700)]
libext2fs: add verity flag to EXT2_LIB_FEATURE_RO_COMPAT_SUPP

The new ro_compat filesystem feature flag for fs-verity was added to
EXT2_FEATURE_RO_COMPAT_SUPP, but that's not actually used by e2fsprogs
itself.  So contrary to the v1.44.4 release notes, 'mke2fs -O verity'
doesn't actually work, nor does e2fsck allow the filesystem to have the
verity feature.  Fix it by adding the flag to the correct place
(EXT2_LIB_FEATURE_RO_COMPAT_SUPP) too.

Fixes: faae7aa00df0 ("Reserve codepoints for the fsverity feature.")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibe2p: fix verity flag bit
Eric Biggers [Mon, 20 Aug 2018 23:37:37 +0000 (16:37 -0700)]
libe2p: fix verity flag bit

The verity flag was mapped to EXT4_PROJINHERIT_FL, presumably due to a
copy+paste error.  Fix it.

Fixes: faae7aa00df0 ("Reserve codepoints for the fsverity feature.")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotune2fs: fix dereference of freed memory after journal replay
Theodore Ts'o [Sun, 19 Aug 2018 20:46:04 +0000 (16:46 -0400)]
tune2fs: fix dereference of freed memory after journal replay

This can be found by running the test t_replay_and_set under valgrind.

Reported-by: Chris Clayton <chris2553@googlemail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoUpdate release notes, etc., for the 1.44.4 release v1.44.4
Theodore Ts'o [Sun, 19 Aug 2018 01:14:56 +0000 (21:14 -0400)]
Update release notes, etc., for the 1.44.4 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: add configuration file for git-buildpackage
Theodore Ts'o [Sun, 19 Aug 2018 02:25:05 +0000 (22:25 -0400)]
debian: add configuration file for git-buildpackage

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: declare that the debian packaging will be found in debian/master
Theodore Ts'o [Sun, 19 Aug 2018 02:19:35 +0000 (22:19 -0400)]
debian: declare that the debian packaging will be found in debian/master

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: fix where docs are installed in the comerr-dev and ss-dev packages
Theodore Ts'o [Sun, 19 Aug 2018 02:14:11 +0000 (22:14 -0400)]
debian: fix where docs are installed in the comerr-dev and ss-dev packages

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: e2fsdroid: Set android_configure when product out is passed.
Sen Jiang [Mon, 13 Aug 2018 18:09:21 +0000 (11:09 -0700)]
AOSP: e2fsdroid: Set android_configure when product out is passed.

The only place that's using |product_out| is android_configure_fs().

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 111439984
Test: generated image has correct permission
Change-Id: I2602686b6b92c3e61a541b8794d266b1ee6a00d1
From AOSP commit: 57c92af0ac608dbb27de9f882336e28de7bb1fa2

5 years agoAOSP: Ignore quotes in safe_print().
Jeff Sharkey [Fri, 1 Jun 2018 16:49:40 +0000 (10:49 -0600)]
AOSP: Ignore quotes in safe_print().

If the value being printed has embedded quotes ("), then printing
those quotes could confuse other tools when parsing the value.

This is the simplest CL to fix the security issue, and we can circle
back to think about more robust escaping in a future CL.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 80436257
Test: manual
Change-Id: Ica17f2c5701573bceafe34f20110d230a3925483
From AOSP commit: efe90c297a8df591c051fdbfacb92b5283390bba

5 years agoAOSP: blkid: Correct the label name for exfat
Upendra [Thu, 1 Mar 2018 08:15:48 +0000 (17:15 +0900)]
AOSP: blkid: Correct the label name for exfat

Volume label name is 16 bit unicode string according to spec.
Currently blkid labels the device without converting it to
utf-8 chars due to which incorrect label is displayed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 74184636
Test: manual
Change-Id: Ib16204c75c2cdf675d480e9c66f484bb3c51108e
From AOSP commit: 25715073b170970469126426196c9e5084613c37

5 years agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Sat, 18 Aug 2018 18:28:35 +0000 (14:28 -0400)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agopo: update es.po (from translationproject.org)
Antonio Ceballos [Sat, 18 Aug 2018 18:28:35 +0000 (14:28 -0400)]
po: update es.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agopo: update da.po (from translationproject.org)
Joe Hansen [Sat, 18 Aug 2018 18:28:35 +0000 (14:28 -0400)]
po: update da.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: fix uninitialized length in rep_strdup()
Theodore Ts'o [Sat, 18 Aug 2018 17:29:41 +0000 (13:29 -0400)]
libext2fs: fix uninitialized length in rep_strdup()

For platforms whose libc don't supply strdup(), the replacement strdup
function in lib/ext2fs/tdb.c needs to always initialize the length
variable.

Reported-by: Vladyslav Tsilytskyi <ykp@protonmail.ch>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoDrop subset tarball and replace it with "configure --enable-subset"
Theodore Ts'o [Sat, 18 Aug 2018 15:19:25 +0000 (11:19 -0400)]
Drop subset tarball and replace it with "configure --enable-subset"

There's no point creating two separate tarfiles.  It's not clear
anyone was actually using the subset tarball --- and if they are, they
can replace it by the full source distribution and using the
--enable-subset option.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoStop generating e2fsprogs.spec automatically
Theodore Ts'o [Sat, 18 Aug 2018 14:42:44 +0000 (10:42 -0400)]
Stop generating e2fsprogs.spec automatically

It adds extra complexity for not much gain, and stands in the way of
generating the release tarfile via git archive.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoRemove obsolete files from the repository
Theodore Ts'o [Sat, 18 Aug 2018 13:55:26 +0000 (09:55 -0400)]
Remove obsolete files from the repository

They are removed when we generate the tarball, and they serve no
useful purpose, so let's remove them.  This will be help us to create
the tarball using git archive more easily.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agogen-tarball: handle symlinks correctly in the created the tar file
Theodore Ts'o [Sat, 18 Aug 2018 04:06:40 +0000 (00:06 -0400)]
gen-tarball: handle symlinks correctly in the created the tar file

Now that we use a symlink for the top-level RELEASE-NOTES file, the
previous strategy of using a symlink to force the prefix in the tar
file and then using tar -h won't work.  So change how we generate the
tar file to take advantage of GNU tar's --transform option.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: mke2fs must not create fs with resize_inode and meta_bg
Lukas Czerner [Mon, 13 Aug 2018 13:17:06 +0000 (15:17 +0200)]
tests: mke2fs must not create fs with resize_inode and meta_bg

Test that mke2fs does not allow to create file system with both
resize_inode and meta_bg features enabled.

This was fixes with commit 42e77d5d ("libext2fs: don't create
filesystems with meta_bg and resize_inode").

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: e2fsck must be able fix fs with resize_inode and meta_bg
Lukas Czerner [Mon, 13 Aug 2018 13:17:05 +0000 (15:17 +0200)]
tests: e2fsck must be able fix fs with resize_inode and meta_bg

Test if the e2fsck can fix file system with resize_inode and meta_bg
features enabled simultaneously.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoReserve codepoints for the fsverity feature.
Theodore Ts'o [Tue, 14 Aug 2018 02:39:27 +0000 (22:39 -0400)]
Reserve codepoints for the fsverity feature.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: fix fd leak in reserve_stdio_fds
Theodore Ts'o [Sun, 12 Aug 2018 00:47:08 +0000 (20:47 -0400)]
e2fsck: fix fd leak in reserve_stdio_fds

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
5 years agoremove unused datarootdir
Lukas Czerner [Thu, 9 Aug 2018 08:35:45 +0000 (10:35 +0200)]
remove unused datarootdir

Remove unused datarootdir variable from compile_et and mk_cmds.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: remove resize inode if both resize_inode and meta_bg are enabled
Lukas Czerner [Wed, 8 Aug 2018 11:52:56 +0000 (13:52 +0200)]
e2fsck: remove resize inode if both resize_inode and meta_bg are enabled

Previous e2fsprogs versions allowed to create a file system with both
resize_inode and meta_bg enabled. This was fixed by upstream commit
42e77d5d ("libext2fs: don't create filesystems with meta_bg and resize_inode")

However e2fsck still does not recognize the conflict and will attempt to
clear and recreate resize_inode if it's corrupted due to this incompatible
feature combination, though it will create it in the same wrong layout.

Fix it by teaching e2fsck to recognize resize_inode and meta_bg
conflict and fixing it by disabling and clearing resize inode.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agobuild: use MKDIR_P instead of MKINSTALLDIRS
Ross Burton [Thu, 10 Jul 2014 14:39:05 +0000 (15:39 +0100)]
build: use MKDIR_P instead of MKINSTALLDIRS

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: support devices w/ non-512 byte block size on Apple Darwin
Fedor Uporov [Sun, 19 Mar 2017 19:29:26 +0000 (22:29 +0300)]
libext2fs: support devices w/ non-512 byte block size on Apple Darwin

Signed-off-by: Fedor Uporov <thisisadrgreenthumb@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: ODR violation in e2fsck during host build
Isaac Chen [Fri, 3 Aug 2018 09:39:31 +0000 (17:39 +0800)]
AOSP: ODR violation in e2fsck during host build

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 112062612
Test: $ m SANITIZE_HOST=address $OUT_DIR/host/linux-x86/bin/e2fsck $OUT_DIR/host/linux-x86/bin/llvm-symbolizer
      $ $OUT_DIR/host/linux-x86/bin/e2fsck

Change-Id: I3f1a18d6d72116d864a79f0acef37625124f4c1a
From AOSP commit: 3271c69c97f486914fea833a36eaf5d86938c76d

5 years agoAOSP: Fix macOS build.
David Anderson [Wed, 25 Jul 2018 19:41:05 +0000 (12:41 -0700)]
AOSP: Fix macOS build.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 111839488
Test: e2fsprogs builds on macOS.
Change-Id: I4ddf332cc244fa44f928cba68470b7f9aa48a556
From AOSP commit: 4dc2456f0e6d10c73372e829e1875ec4095e8fa6