Whamcloud - gitweb
tools/e2fsprogs.git
2 years agoLU-15682 build: update version to 1.46.2.wc5 v1.46.2.wc5-lustre v1.46.2.wc5
Andreas Dilger [Thu, 24 Mar 2022 22:39:58 +0000 (16:39 -0600)]
LU-15682 build: update version to 1.46.2.wc5

b62048305 LU-15682 build: add AlmaLinux rpm support
980a75706 LU-15590 libext2fs: fix direct I/O read
b15a0ad2f LU-11545 debugfs: allow <inode> for ncheck
d31671c78 LU-11604 tests: fix ACL-printing tests

Change-Id: I98aec4a3842351881e84a08dfa70230347d17f16
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
2 years agoLU-15682 build: add AlmaLinux rpm support 15/46915/2
Minh Diep [Wed, 23 Mar 2022 19:14:56 +0000 (12:14 -0700)]
LU-15682 build: add AlmaLinux rpm support

Build RPMS on AlmaLinux which is the same
with CentOS

Change-Id: I068c9d8d1df4956c5b5eb0c2e1e979271cfa5621
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46915
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-15590 libext2fs: fix direct I/O read 01/46601/2
John L. Hammond [Wed, 23 Feb 2022 22:27:38 +0000 (16:27 -0600)]
LU-15590 libext2fs: fix direct I/O read

In the direct I/O bounce buffer case of raw_read_blk(), don't clobber
"actual" with "size" after reading.

Fixes: d557b965 libext2fs: fix potential races in unix_io
Signed-off-by: John L. Hammond <jhammond@whamcloud.com>
Change-Id: Ice42596be8e9db84fd49cbea25d3cd0fdf76589a
Reviewed-on: https://review.whamcloud.com/46601
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-11545 debugfs: allow <inode> for ncheck 88/44388/4
Li Dongyang [Fri, 23 Jul 2021 03:19:03 +0000 (13:19 +1000)]
LU-11545 debugfs: allow <inode> for ncheck

If the arg string is of the form <ino>, allow it
for ncheck.
Improve the error message, use "Invalid inode number"
instead of "Bad inode", which implies the inode
content being bad.

Change-Id: Ib6d7eb53342d93c9e8ecf25835d8ff65bc340980
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/44388
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-11604 tests: fix ACL-printing tests 24/46024/3
Andreas Dilger [Sat, 8 Jan 2022 01:21:40 +0000 (18:21 -0700)]
LU-11604 tests: fix ACL-printing tests

Fix the ACL-printing tests to be more flexible for different systems.
If the MKFS_DIR is on tmpfs, it will not list "system.posix_acl*"
xattrs, so they will not be copied.  Create this on a real filesystem
or skip the test if that doesn't work.

Filter out the security.selinux xattr if it is printed, since this
depends on the selinux configuration of the host system.  However,
this also spills xattrs for "acl_dir/file" into an external xattr
block, and causes the test to fail due to different block allocations.
Increase the filesystem inode size so that the allocation is the same
regardless of whether selinux is enabled or not.

Print out the contents of failed test files in case of errors.

Fix warning in print_acl() from printing "void *" instead of "char *".

Fixes: 8631879536 ("LU-11604 debugfs: add support for printing ACL")
Fixes: 67e6ae0a35 ("mke2fs: fix a importing a directory with an ACL and inline data")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I62512c457bb3f1d2a59038c7f02e5c27e6916a54
Reviewed-on: https://review.whamcloud.com/46024
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
2 years agoLU-15330 build: update version to 1.46.2.wc4 75/45875/2 v1.46.2.wc4
Andreas Dilger [Fri, 17 Dec 2021 05:09:12 +0000 (22:09 -0700)]
LU-15330 build: update version to 1.46.2.wc4

92846e03 LU-15330 e2fsck: no parent lookup in disconnected dir
53e89f07 LU-15164 misc: fix chattr usage message for project ID
35ce354f LU-13717 sec: process Lustre enc inodes as normal enc inodes
d35469d6 LU-13717 sec: support encrypted files handling in pfsck mode
c6c08da9 LU-14953 e2fsck: pfsck progress report
318931a7 LU-14784 contrib: add rocky linux rpm support

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ia81fd00adfffd35cd7a4b250aa1d974c8a80ed7f
Reviewed-on: https://review.whamcloud.com/45875
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-15330 e2fsck: no parent lookup in disconnected dir 85/45785/2
Andreas Dilger [Wed, 8 Dec 2021 07:35:04 +0000 (00:35 -0700)]
LU-15330 e2fsck: no parent lookup in disconnected dir

Don't call ext2fs_get_pathname() to do a name lookup for a
disconnected directory, since the directory block traversal
in pass1 has already scanned all of the leaf blocks and not
found the relevant entry.  If it had been found the directory
would not be disconnected in pass3.

Instead, print the ".." directory name in the prompt directly.
This avoids a potentially lengthy directory traversal for each
disconnected entry if the previous parent is large that never
finds the entry.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: If17a92689f24f365ca1fbe5c837e7d5f383ebbe5
Reviewed-on: https://review.whamcloud.com/45785
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
2 years agoLU-15164 misc: fix chattr usage message for project ID 01/45701/2
Andreas Dilger [Wed, 1 Dec 2021 23:08:51 +0000 (16:08 -0700)]
LU-15164 misc: fix chattr usage message for project ID

Fix the "chattr -h" usage message to properly document that the
"-p" option takes a project argument, like "-v" takes a version.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I2a219450ceecf0614aa73fb408fd0c77d53ebbe5
Reviewed-on: https://review.whamcloud.com/45701
Reviewed-by: Elena Gryaznova <elena.gryaznova@hpe.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-13717 sec: process Lustre enc inodes as normal enc inodes 12/45212/6
Sebastien Buisson [Tue, 19 Oct 2021 11:06:02 +0000 (13:06 +0200)]
LU-13717 sec: process Lustre enc inodes as normal enc inodes

Lustre encrypted inodes have the EXT4_ENCRYPT_FL flag set on disk.
This makes it possible for e2fsprogs to consider them as normal
encrypted inodes.
But as Lustre encrypted inodes may contain illegal characters in their
names, it is also needed to escape non-printable characters in
linkEA.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Iaf495f399e38e3ca7914b92059607d4babc1ad43
Reviewed-on: https://review.whamcloud.com/45212
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
2 years agoLU-13717 sec: support encrypted files handling in pfsck mode 89/45289/2
Sebastien Buisson [Tue, 19 Oct 2021 11:02:12 +0000 (13:02 +0200)]
LU-13717 sec: support encrypted files handling in pfsck mode

e2fsck needs to be improved in order to support encrypted files
handling in parallel fsck mode. The e2fsck_merge_encrypted_info()
function is added to merge encrypted inodes info collected from
different threads in pass1, so that it can be used in pass2.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Iaf495f399e38e3ca7914b92059607d4babc1ad44
Reviewed-on: https://review.whamcloud.com/45289
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
2 years agoLU-14953 e2fsck: pfsck progress report 84/44784/4
Li Dongyang [Mon, 30 Aug 2021 12:43:52 +0000 (22:43 +1000)]
LU-14953 e2fsck: pfsck progress report

Re-enable progress support for pfsck.
To make it work, in pass1 before calling e2fsck_update_progress,
figure out the the progress for other threads as well.

Change-Id: Ia039aa20f35990b550680169c8b3670b4346ce8b
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/44784
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
2 years agoLU-14784 contrib: add rocky linux rpm support 67/44067/2
Wang Shilong [Thu, 24 Jun 2021 05:51:07 +0000 (01:51 -0400)]
LU-14784 contrib: add rocky linux rpm support

Build RPMS on Rocky Linux make no difference with Centos8,
make build-rpm select right spec file for rocky.

Change-Id: I3b5d05a137359185ae3e9695d4d360a24d4510db
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/44067
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agobuild: update version to 1.46.2.wc3 v1.46.2.wc3
Li Dongyang [Fri, 18 Jun 2021 00:56:47 +0000 (10:56 +1000)]
build: update version to 1.46.2.wc3

21c888cd LU-14769 e2fsck: init inode_badness proper for thread context
059e8788 LU-14768 e2fsck: merge expand_eisize_map properly
46a2ac19 LU-14768 e2fsck: merge casefolded dir lists after thread finish

Change-Id: I4cb9a1c6c1ba9d0765c15dfafd948af9c5052be2
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
2 years agoLU-14769 e2fsck: init inode_badness proper for thread context 12/44012/3
Wang Shilong [Thu, 27 May 2021 05:04:08 +0000 (13:04 +0800)]
LU-14769 e2fsck: init inode_badness proper for thread context

Some bad inode might be added before pass1, so global_ctx's
@inode_badness might be not NULL, we need init thread_ctx's
inode badness as NULL.

Change-Id: I31a526fd0cfc0c9f8c13598deba4ae882080412f
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44012
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
2 years agoLU-14768 e2fsck: merge expand_eisize_map properly 11/44011/3
Wang Shilong [Tue, 25 Aug 2020 08:31:27 +0000 (16:31 +0800)]
LU-14768 e2fsck: merge expand_eisize_map properly

Min known min_extra_isize should be updated after
threads finish.

Original commit:
cb4f0f44 ("LU-8465 e2fsck: merge expand_eisize_map properly")

Add the missing commit back, in pass5 we won't pick up some of
the inodes marked in pass1 for eisize expanding.

This should be merged to
e47509eb ("e2fsck: add support for expanding the inode size")
in the next rebase.

Change-Id: Ie9703383821ecb11337630d74ffb0c7dcb2fcc1e
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/44011
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
2 years agoLU-14768 e2fsck: merge casefolded dir lists after thread finish 10/44010/3
Wang Shilong [Thu, 12 Mar 2020 11:40:27 +0000 (19:40 +0800)]
LU-14768 e2fsck: merge casefolded dir lists after thread finish

This is missed and should be done after threads finish.

Original commit:
18538b27 ("LU-8465 e2fsck: merge encrypted dir lists after thread finish")
Upstream is now using e2fsck_struct->casefolded_dirs instead of
encrypted_dirs.

Only for the correctness of pfsck, we won't use casefolded feature on
ldiskfs.

Change-Id: I6f3a28501886c2ed4bec26dc5c5e5a1914fece04
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/44010
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
2 years agobuild: update version to 1.46.2.wc2 v1.46.2.wc2
Li Dongyang [Tue, 8 Jun 2021 00:11:38 +0000 (10:11 +1000)]
build: update version to 1.46.2.wc2

8495892a LU-14432 ext2fs: fix ext2fs_get_avg_group() warning
5aa781e2 LU-14710 e2fsck: fix ".." more gracefully if possible
933bb7f7 LU-14664 debugfs: print FLR values for trusted.fid

Change-Id: Icfa84c71b9c2ad2ff8e1890679533a85be873640
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
2 years agoLU-14432 ext2fs: fix ext2fs_get_avg_group() warning 81/43881/2
Andreas Dilger [Mon, 31 May 2021 21:08:13 +0000 (15:08 -0600)]
LU-14432 ext2fs: fix ext2fs_get_avg_group() warning

Move ext2fs_get_avg_group() into e2fsck/pass1.c instead of the
ext2fs.h header, since it is currently only used in that one
function.  It is too large to be a static inline function, and
it is currently causing many compile warnings because it is
not marked with "_INLINE_".

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ie948bc10f44dccf91558099a5217ea1fb5ce7057
Reviewed-on: https://review.whamcloud.com/43881
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-14710 e2fsck: fix ".." more gracefully if possible 58/43858/3
Andreas Dilger [Fri, 28 May 2021 04:57:20 +0000 (22:57 -0600)]
LU-14710 e2fsck: fix ".." more gracefully if possible

If the "." entry is corrupted, it will be reset in check_dot().
It is possible that the ".." entry can be recovered from the
directory block instead of also resetting it immediately.  If
it appears that there is a valid ".." entry in the block, allow
that to be used, and let check_dotdot() verify the dirent itself.

When resetting the "." and ".." entries, use EXT2_FT_DIR as the
file type instead of EXT2_FT_UNKNOWN, to avoid extra problems
later can easily be avoided.

Fixup affected tests using the new "repair-test" script that
updates the expect.[12] files from $test.[12].log for the given
tests and re-runs the test to ensure it now passes.

Change-Id: Ia5e579bcf31a9d9ee260d5640de6dbdb60514823
Signed-off-by: Andreas dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/43858
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
2 years agoLU-14664 debugfs: print FLR values for trusted.fid 19/43519/2
Etienne AUJAMES [Mon, 3 May 2021 18:19:12 +0000 (20:19 +0200)]
LU-14664 debugfs: print FLR values for trusted.fid

Add "layout_version" and "range" values when printing a trusted.fid
xattr.
Homogenizes the debugfs output with "ll_decode_filter".

Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: I1a5b4790762afc389528dc525e169ac6c75eb8bf
Reviewed-on: https://review.whamcloud.com/43519
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
2 years agoLU-11604 debugfs: add support for printing ACL 84/43384/4 v1.46.2.wc1
Li Dongyang [Wed, 21 Apr 2021 12:43:09 +0000 (22:43 +1000)]
LU-11604 debugfs: add support for printing ACL

decode and print Access Control Lists in debugfs stat/ea_list

Change-Id: I3ee35ddb02582ab66d4e25ff76fae35935b54508
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/43384
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-11604 debugfs: add support for printing linkEA 83/43383/3
Li Dongyang [Wed, 21 Apr 2021 11:50:20 +0000 (21:50 +1000)]
LU-11604 debugfs: add support for printing linkEA

Allow debugfs "stat" to decode and print the linkEA for each inode.

Change-Id: I9aa27a857cb68af7670b900f1fc3f9804aa8c837
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/43383
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
2 years agoLU-11446 e2fsck: check trusted.link when fixing nlink 31/43231/2
Li Dongyang [Tue, 30 Mar 2021 11:22:40 +0000 (22:22 +1100)]
LU-11446 e2fsck: check trusted.link when fixing nlink

The inode link count could be higher than what is stored in the
local MDT inode because of remote file links from DNE MDTs.
If we find a mismatched link count, look up the "trusted.link"
xattr.  If it exists, do a sanity check on it, and use the
leh_reccount stored there if larger than the local link count.

If leh_overflow_time is set, then the "trusted.link" xattr may
not hold all of the links, so assume the maximum of available
link counts is valid until LFSCK clears leh_overflow_time.

  LU-14600 e2fsck: check trusted.link after linking inode

  If the inode is not linked into the namespace, link it into
  lost+found before checking the trusted.link xattr to get the
  DNE link count.

  Fixes: 6528bce00bea ("LU-11446 e2fsck: check trusted.link when fixing nlink")
  Test-Parameters: testlist=sanity-lfsck
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Change-Id: I447c1ce32f965311bfed1c08381928737dd9b02c
  Reviewed-on: https://review.whamcloud.com/43324
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
  LU-14600 e2fsck: trusted.link unref inode test case

  Update the f_trusted_link test case to include a locally
  unreferenced inode that has a trusted.link xattr.  The
  inode should be linked into lost+found because of the xattr,
  even if it has no blocks/data, and the link cound should be
  extracted from the trusted.link xattr.

  Change-Id: Ifad410d0bc1ceb140216dbed48e54ea3825abe3b
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Reviewed-on: https://review.whamcloud.com/43335
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: I213d816a92043c348eb55374aaa98e98957ccf23
Reviewed-on: https://review.whamcloud.com/43169
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
2 years agoLU-13797 e2fsck: quiet 'extent tree could be narrower'
Andreas Dilger [Sat, 12 Dec 2020 10:17:18 +0000 (03:17 -0700)]
LU-13797 e2fsck: quiet 'extent tree could be narrower'

The "extent tree (at level 1) could be narrower" message is
overly verbose and raises concerns by end users, even though
it is harmless.  On the flip side, this may save only a few
hundred blocks in the filesystem for a short period of time,
so there is relatively little benefit to be had.

Disable the extent optimization step in e2fsck by default by
adding the "no_optimize_extents" option to e2fsck.conf.

Change-Id: I0cee9407ef0653c3b946908513f3429816b89548
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/40952
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
2 years agoLU-11915 deubugfs: add support for xattrs in external inodes
Artem Blagodarenko [Thu, 4 Jul 2019 10:54:17 +0000 (13:54 +0300)]
LU-11915 deubugfs: add support for xattrs in external inodes

There was "e2fsck: add support for xattrs in external inodes" before
that added xattr in external inode support to utils. But it was
not applied to the last e2fsprogs version for some reasons.

This patch adds external inode output to debugfs that is required
for conf-sanity 115 test.

Change-Id: I3cfca85e2d34b54030d21fafa12be3dbf30e5b5c
Signed-off-by: Artem Blagodarenko <c17828@cray.com>
Reviewed-on: https://review.whamcloud.com/35417
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
2 years agoLU-12158 mke2fs: avoid too large stride and stripe_width
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>
2 years agoLU-11609 mke2fs: allow 64bit feature without extents
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>
2 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>
2 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>
2 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>
2 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>
2 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

2 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>
  LU-12641 libext2fs: memory leak of check_if_lustre_mounted

  check_if_lustre_mounted() doesn't free the allocated memory
  if failure.

  Change-Id: I36b5c1e981ca4f1db8c9515be29dd98c074d14dc
Signed-off-by: Li Xi <lixi@ddn.com>
  Reviewed-on: https://review.whamcloud.com/35729
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
2 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.

Increase the size of xattrs hex-dumped from 40 to 120.

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

  LU-5949 e2fsck: simplify inode badness handling

  Move the badness increment into fix_problem() so that code does
  not need to be spread across the code and explicitly set.  Instead,
  take advantage of the fact that pctx->ino is almost always pointing
  at the bad inode and increment badness whenever fix_problem() is
  called on the inode.  This also handles new problems in the future.

  That leaves only a handful of places in the code that need special
  handling to either set a higher badness (e.g. inode blocks that are
  directly referencing filesystem metadata or have wildly incorrect
  timestamps), or should not contribute to inode badness at all.

  The main exceptions are when reprocessing duplicate blocks in the
  inode (badness already set), and cleaning bad entries in a directory
  leaf block in check_dir_block(), which uses pctx->ino to reference
  the parent directory inode number.  In such cases, fix_problem_bad()
  is called with 0 badness, since the leaf block was been repaired,
  and clearing the directory inode in this case is unnecessary.

  This patch should be merged into original badness patch on rebase.

  Fixes: 92a85a3ced2c ("e2fsck: track errors/badness found for each inode")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Change-Id: I96cd21b5976991f0bb1c63fc99857c80e23ebbe5
  Reviewed-on: https://review.whamcloud.com/41328
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Change-Id: Ie3f1f33a1e227cd241632e1506344f53788b3109
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
3 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).

  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>
  LU-8465 e2fsck: merge inode_badness after threads finish

  inode_badness is only specific for master-lustre branch,
  seperate it and fix a bug that inode_badness is not freed properly

Signed-off-by: Wang Shilong <wshilong@ddn.com>
  Change-Id: I75a54adc088cb5b636171e4ee7929496858fedf9
  Reviewed-on: https://review.whamcloud.com/39843
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
  LU-5949 e2fsck: simplify inode badness handling

  Move the badness increment into fix_problem() so that code does
  not need to be spread across the code and explicitly set.  Instead,
  take advantage of the fact that pctx->ino is almost always pointing
  at the bad inode and increment badness whenever fix_problem() is
  called on the inode.  This also handles new problems in the future.

  That leaves only a handful of places in the code that need special
  handling to either set a higher badness (e.g. inode blocks that are
  directly referencing filesystem metadata or have wildly incorrect
  timestamps), or should not contribute to inode badness at all.

  The main exceptions are when reprocessing duplicate blocks in the
  inode (badness already set), and cleaning bad entries in a directory
  leaf block in check_dir_block(), which uses pctx->ino to reference
  the parent directory inode number.  In such cases, fix_problem_bad()
  is called with 0 badness, since the leaf block was been repaired,
  and clearing the directory inode in this case is unnecessary.

  This patch should be merged into original badness patch on rebase.

  Fixes: 92a85a3ced2c ("e2fsck: track errors/badness found for each inode")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Change-Id: I96cd21b5976991f0bb1c63fc99857c80e23ebbe5
  Reviewed-on: https://review.whamcloud.com/41328
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
  LU-5949 e2fsck: call delete_inode() properly

  Fix incorrect argument for delete_inode() in pass1b().

  Fixes: 8725134d2757 ("LU-5949 e2fsck: simplify inode badness handling")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Change-Id: Ib90d87055e2c9359005034d06d88b083423ebbe5
  Reviewed-on: https://review.whamcloud.com/41450
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Change-Id: I9f5f48d979afebb9c953d9fb2777ebf570f30c15
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
3 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>
3 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>
3 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

Change-Id: I132a3122076b5c68c4f9ea8c1316cb48f8d94020
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
3 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>
3 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.

  filefrag: support PFL and FLR file

  Add FIEMAP_EXTENT_DATA_MIRROR support FLR file, which is returned
  from Lustre indicating that a new mirror will be processed, so we'd
  reset the fm_start and fe_logical.

  Change-Id: Ifa68d951ac68d9f141eae915e58c13d73833c8c9
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
  Reviewed-on: https://review.whamcloud.com/40765
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
  LU-11848 filefrag: add -V option to print version

  Add '-V' to filefrag to print the installed version of the tool.

  If '-V' is used twice, print out the list of supported FIEMAP flags.
  This can be used to check if filefrag understands a specific feature.

  Change-Id: Ib126bdd70efa1775aef6db761f54e27a593ebbe5
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Reviewed-on: https://review.whamcloud.com/40873
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
  LU-11848 filefrag: rework port PFL and FLR file

  Lustre uses the high 16bits of fiemap_extent:fe_device to record
  the absolute stripe number is under process, so that next fiemap
  call continues from that stripe.

  Fixes: 0b6718f5e22d ("filefrag: support PFL and FLR file")
  Change-Id: I111bcb100307aebacbffed99109057accdc27f5b
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
  Reviewed-on: https://review.whamcloud.com/40889
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
  LU-11848 filefrag: further PFL and FLR fixes

  Revert some of the changes from the earlier patches to bring the
  filefrag functionality closer to the original behavior.

  The kernel is instead changed to return the device number with
  every extent.  This allows the previous filefrag to work for PFL
  and FLR files without any changes by just copying the fe_device
  from the last returned extent to the next call.  The only gap in
  old filefrag is that it prints the stripe number with OST index.

  Fixes: d99d208e73cd ("LU-11848 filefrag: rework port PFL and FLR file")
  Fixes: 0b6718f5e22d ("filefrag: support PFL and FLR file")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Change-Id: Ie6a8d93ebceb1e70894b21f0dadc9655083ebbe5
  Reviewed-on: https://review.whamcloud.com/40932
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Change-Id: Ifb40cc159ddc61d2296c494f0e899ac11bf88b60
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
3 years agoLU-13241 libext2fs: add quota to libext2fs
Li Dongyang [Mon, 23 Mar 2020 01:56:00 +0000 (12:56 +1100)]
LU-13241 libext2fs: add quota to libext2fs

add quota related interface to libext2fs and install the
relevant headers.

Change-Id: I17e6b5aa74e0f1bb1465168a1cf4e03184e003b0
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/38027
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
3 years agoATM-1754 tests: skip f_large_dir on RHEL6
Andreas Dilger [Fri, 25 Sep 2020 02:52:03 +0000 (20:52 -0600)]
ATM-1754 tests: skip f_large_dir on RHEL6

Skip f_large_dir test on RHEL6 since it runs very slowly, and
has enough coverage on other branches.

Change-Id: I7e001f734d84fc7927bed1da861a33283577d490
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/40042
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
3 years agoATM-1754 tests: skip f_large_dir(_csum) on aarch64
Andreas Dilger [Thu, 21 May 2020 20:57:49 +0000 (14:57 -0600)]
ATM-1754 tests: skip f_large_dir(_csum) on aarch64

Skip the f_large_dir(_csum) tests on the aarch64 builders because this is
extremely slow (90 minutes) and clogs up the build system when
there are many patches in the queue.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I8c3a588c34caae5332b4c643df940b0e855cab07
Reviewed-on: https://review.whamcloud.com/38693
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
3 years agoLU-13177 build: add support for SLES15SP1
Minh Diep [Tue, 28 Jan 2020 22:35:46 +0000 (14:35 -0800)]
LU-13177 build: add support for SLES15SP1

Add SUSE 15SP1 to distro and spec file

Change-Id: Ica12ae0246db4755746ada6647122e8853fc6258
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/37357
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
3 years agoLU-12403 build: add support for RHEL/CentOS 8
Li Dongyang [Tue, 11 Jun 2019 05:05:03 +0000 (15:05 +1000)]
LU-12403 build: add support for RHEL/CentOS 8

Add RHEL/CentOS 8 to Distro, reuse the RHEL 7 spec.

Change-Id: Ic0fa915d1145ffc04bd5f6f7e3531b892a3d004a
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/35168
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
3 years agoLU-12226 debian: fix debhelper level requirement
Li Dongyang [Fri, 26 Apr 2019 05:23:28 +0000 (15:23 +1000)]
LU-12226 debian: fix debhelper level requirement

Requiring debhelper >= 11 will break the build on
Ubuntu 16.04 LTS, it only has debhelper 9 and 10
from backports.

As we dropped the build for 16.04, change the required
debhelper to 11, which is the version shipping with
18.04

Change-Id: I40838a4de5ee7a841ba970d4f7531f8fe9dc5ff4
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/34765
Reviewed-by: Minh Diep <mdiep@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
3 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>
3 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>
3 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

3 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

3 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>
3 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>
3 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>
3 years agoLU-14432 configure.ac: fix AC_PREREQ
Li Dongyang [Sun, 14 Feb 2021 23:30:11 +0000 (10:30 +1100)]
LU-14432 configure.ac: fix AC_PREREQ

AS_HELP_STRING was introduced in autoconf 2.58
requiring autoconf 2.69 is not necessary and it breaks
several builds in our Jenkins.

Change required autoconf to 2.59 just to be safe.

Change-Id: I30af873879866858d32b715ac4ce78d095e10f7d
Fixes: 8c9e2921 ("configure.ac: convert all help strings to use AS_HELP_STRING")
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/41665
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
3 years agoe2fsck: Annotating fields in e2fsck_struct
Saranya Muruganandam [Tue, 17 Nov 2020 17:54:30 +0000 (09:54 -0800)]
e2fsck: Annotating fields in e2fsck_struct

Adding information on fields in e2fsck_struct
on how they are used when running parallel fsck.

E2fsprogs-commit: c2f04f7da367ffc4cd64be5b2285878ad23b3e7f

Change-Id: I5b97921f0191b1d2bf4bf6bbedefc7ae401e9e33
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: propagate number of threads
Saranya Muruganandam [Fri, 13 Nov 2020 23:33:05 +0000 (15:33 -0800)]
e2fsck: propagate number of threads

Sometimes, such as in orphan_inode case, e2fsck_pass1
is called after reading the block bitmaps. This results in
reading the block bitmap sequentially and multithreading
only gets kicked in later. Fix the thread count earlier
while setting up the file system.

E2fsprogs-commit: 3f56676f4daa7379dbd868a4114910f20d49527d

Change-Id: I51ab36ad8094c605a32e4b7929fadb326d77169e
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: misc cleanups for pfsck
Andreas Dilger [Mon, 28 Sep 2020 19:21:16 +0000 (13:21 -0600)]
e2fsck: misc cleanups for pfsck

Add -m option description to e2fsck.8 man page.

Rename e2fsck_struct fs_num_threads to pfs_num_threads to avoid
confusion with the ext2_filsys fs_num_threads field, and move
thread_info to be together with the other HAVE_PTHREAD fields.

Move ext2_filsys fs_num_threads to fit into the __u16 "pad" field
to avoid consuming one of the few remaining __u32 reserved fields.

Fix a few print format warnings.

E2fsprogs-commit: afad25acf8c6694c8cea08820fe5af84388a76f3

Change-Id: I5ab49a3ad41f1ebb374669c5d640afa1f3fc35fd
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: fix memory leaks with pfsck enabled
Wang Shilong [Mon, 28 Sep 2020 02:27:12 +0000 (10:27 +0800)]
e2fsck: fix memory leaks with pfsck enabled

valgrind detected two memory leaks:

1) quota context is not released after merging.
2) @refcount_orig should be released

E2fsprogs-commit: d9aa090f713ecf3393c4e68d951a03ccba4a7073

Change-Id: I8b8379505524d25b5c18a0d67bb4dd8ede3494ef
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agotests: add pfsck test
Wang Shilong [Wed, 23 Sep 2020 15:58:23 +0000 (23:58 +0800)]
tests: add pfsck test

pfsck run on a clean fs should not return any errors.

Generate an image with possible features enabled,
especially EA shared blocks etc.

E2fsprogs-commit: 59ae5e5a627aaa24d663e8ce41955e1ded46633a

Change-Id: Ifa8d725993cf8bec08e847e2734bb44b0ddbfd04
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: reset @inodes_to_rebuild if restart
Wang Shilong [Thu, 24 Sep 2020 02:00:06 +0000 (10:00 +0800)]
e2fsck: reset @inodes_to_rebuild if restart

Verify multiple thread on a corrupted images hit following bug:

pass1.c:2902: e2fsck_pass1_thread_prepare:
Assertion `global_ctx->inodes_to_rebuild == NULL' failed.
Signal (6) SIGABRT si_code=SI_TKILL
./e2fsck/e2fsck[0x43829e]
/lib64/libpthread.so.0(+0x14b20)[0x7f3b45135b20]
/lib64/libc.so.6(gsignal+0x145)[0x7f3b44f2c625]
/lib64/libc.so.6(abort+0x12b)[0x7f3b44f158d9]
/lib64/libc.so.6(+0x257a9)[0x7f3b44f157a9]
/lib64/libc.so.6(+0x34a66)[0x7f3b44f24a66]
./e2fsck/e2fsck(e2fsck_pass1+0x1662)[0x423572]
./e2fsck/e2fsck(e2fsck_run+0x5a)[0x41611a]
./e2fsck/e2fsck(main+0x1608)[0x4121b8]
/lib64/libc.so.6(__libc_start_main+0xf3)[0x7f3b44f171a3]
./e2fsck/e2fsck(_start+0x2e)[0x413dde]

@inodes_to_rebuild could be not NULL after we restart pass1

E2fsprogs-commit: 3b7879e310d30d5f4c518c607aec830b63b2315b

Change-Id: I8ca6a37d41788333fe9494bd84816932f39fcb3c
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: update mmp block in one thread
Wang Shilong [Wed, 23 Sep 2020 14:36:41 +0000 (22:36 +0800)]
e2fsck: update mmp block in one thread

For multiple threads, different threads will try to
update mmp block at the same time, only allow one
thread to update it.

E2fsprogs-commit: 1806140014cbce395d0ca4a51d46fa21e2833241

Change-Id: Id78b949d338c384a64828b955ed7477aa816f8ee
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: make default smallest RA size to 1M
Wang Shilong [Tue, 15 Sep 2020 07:06:11 +0000 (15:06 +0800)]
e2fsck: make default smallest RA size to 1M

If we have a smaller inodes per group, default ra size could
be very small(etc 128KiB), this hurts performances.

Tune above 128K to 1M, i see pass1 time drop down from
677.12 seconds to 246 secons with 32 threads.

E2fsprogs-commit: 9226b3264b74044013f4933280b1989c33be42f3

Change-Id: Ia503b4f73dc8f3d5e6be705c7311bdacc5b874a9
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: avoid too much memory allocation for pfsck
Wang Shilong [Wed, 27 May 2020 07:14:23 +0000 (07:14 +0000)]
e2fsck: avoid too much memory allocation for pfsck

e2fsck init memory according to filesystem inodes/dir numbers
recorded in the superblock, this should be aware of filesystem
number of threads, otherwise, oom happen.

E2fsprogs-commit: ed2cec54da604efe1af2734182985d1730674138

Change-Id: Ia66cd782a330f3f0215c7119c25ef701edc8b143
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: cleanup e2fsck_pass1_thread_join()
Wang Shilong [Wed, 23 Sep 2020 10:05:34 +0000 (18:05 +0800)]
e2fsck: cleanup e2fsck_pass1_thread_join()

Use e2fsck_reset_context() to free memory to simpify
codes.

E2fsprogs-commit: 41f40f4215fd9a357a3d250a34745eb953982bda

Change-Id: I1fdf12eb520f738d90453bbc886dbe89bc9a2b17
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: wait fix thread finish before checking
Wang Shilong [Thu, 14 May 2020 14:16:50 +0000 (22:16 +0800)]
e2fsck: wait fix thread finish before checking

Before proceeding next inodes, waitting existed
fixing finished.

E2fsprogs-commit: ae4a78493b16d01d7dbe628ec9064216f960bd16

Change-Id: I159082381e66bd51b3558a65ef45e936aa741370
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: set E2F_FLAG_ALLOC_OK after threads
Wang Shilong [Thu, 16 Apr 2020 07:08:31 +0000 (15:08 +0800)]
e2fsck: set E2F_FLAG_ALLOC_OK after threads

Only flag ALLOC OK after all threads finished without problem.

E2fsprogs-commit: 2c1e9ced674f0d8e634c3b6299ce9bdfbe4b8739

Change-Id: I764d08bab5299ec0aec9d7d5e9b21320c085dee9
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: simplify e2fsck context merging codes
Wang Shilong [Fri, 13 Mar 2020 10:46:24 +0000 (18:46 +0800)]
e2fsck: simplify e2fsck context merging codes

We tried to copy thread context to global context directly
and then copy back some saved variables before merging.

Since we have finished almost all necessary variables
in the e2fsck context, we could simplify codes, and
this could help us understand what is missing rather
than hide problems.

E2fsprogs-commit: 41c991af7ed7244da0fd799f63e4e6fd0d6c5b25

Change-Id: I450e3f5fb26c5c6fe8a075373bf538965f443d02
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge extent depth count after threads finish
Wang Shilong [Fri, 20 Mar 2020 01:55:18 +0000 (09:55 +0800)]
e2fsck: merge extent depth count after threads finish

tests covered by f_extent_htree.

E2fsprogs-commit: 291bc9b7fc5280166e58b0e586d5ec93738f31a7

Change-Id: I5b4f629e1031f719a2d032a9dd5edb1cfac90975
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: reset lost_and_found after threads finish
Wang Shilong [Fri, 20 Mar 2020 01:50:56 +0000 (09:50 +0800)]
e2fsck: reset lost_and_found after threads finish

This should not be kept, the reaons is similar to what
e2fsck_pass1 has done before.

E2fsprogs-commit: 10abbf8fd534d61c40fbf9699bf605ac6456b2e2

Change-Id: I0e431be7619720e31927ab1df7034aee1e3eb747
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge options after threads finish
Wang Shilong [Thu, 19 Mar 2020 14:05:30 +0000 (22:05 +0800)]
e2fsck: merge options after threads finish

It will be possible that threads might append E2F_OPT_YES,
so we need merge options to global, test f_yesall cover this.

E2fsprogs-commit: a68a5e890793eda2e8d7b4f7d27d23a7eeb474c5

Change-Id: I0e8bbc078fc538bd7d948ced1161506710401ab3
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: fix readahead for pfsck of pass1
Wang Shilong [Wed, 11 Mar 2020 12:48:00 +0000 (20:48 +0800)]
e2fsck: fix readahead for pfsck of pass1

Several improvments for this patch:

1) move readahead_kb detection to preparing phase.
2) inode readahead should be aware of thread block group
boundary.
3) make readahead_kb aware of multiple threads.

E2fsprogs-commit: 02618b8f69c1ed453b092476cbd0d735206c939d

Change-Id: I2f9d7b8ae5039c0551bb3994f1c7814af257cee5
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: adjust number of threads
Wang Shilong [Wed, 9 Sep 2020 07:07:10 +0000 (15:07 +0800)]
e2fsck: adjust number of threads

number of threads should not exceed flex bg numbers,
and output messages if we adjust threads number.

E2fsprogs-commit: 56070582ad951aa55b6eeecd7e8e2a19d53bbff6

Change-Id: I8bc87e6ca99205d7fc9e0c9f35d0ba9c3eed38ca
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: allow admin specify number of threads
Wang Shilong [Mon, 9 Mar 2020 07:11:10 +0000 (15:11 +0800)]
e2fsck: allow admin specify number of threads

-m option is introduced to specify number of threads for pfsck.

E2fsprogs-commit: e3bb22efe1c62f8c81686e1d8d065a4943e14bd3

Change-Id: I856d06e0c62f23bdd84e7b6bf53cdc4a46dd58da
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: kickoff mutex lock for block found map
Wang Shilong [Wed, 11 Mar 2020 02:12:18 +0000 (10:12 +0800)]
e2fsck: kickoff mutex lock for block found map

Now @block_found_map is no longer shared by multiple threads,
and @block_dup_map need be checked again after threads finish.

E2fsprogs-commit: 17df3e9f85594eca5515630753542ab5a5c92ee1

Change-Id: I4fb9ae84b70b7ee7d7ce2c0f7a8876ab89c31b5c
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge EA blocks properly
Wang Shilong [Thu, 12 Mar 2020 08:05:51 +0000 (16:05 +0800)]
e2fsck: merge EA blocks properly

EA blocks might be shared, merge them carefully.

E2fsprogs-commit: b9c38a69ff1af2e0c2b9ddce96de965ce62b0de6

Change-Id: Ib01b7cf9c32f7e119bfd00972488b731b13f1ed9
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: split and merge invalid bitmaps
Wang Shilong [Sat, 14 Dec 2019 05:12:36 +0000 (13:12 +0800)]
e2fsck: split and merge invalid bitmaps

Invalid bitmaps are splitted per thread, and we
should merge them after thread finish.

E2fsprogs-commit: e3e15f5c8f72f95d65d602929f59c1c78e72c5a0

Change-Id: I004f595c107adf390f3b16b90cb4b6aa3650f9de
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: move some fixes out of parallel pthreads
Wang Shilong [Sat, 7 Mar 2020 14:00:45 +0000 (22:00 +0800)]
e2fsck: move some fixes out of parallel pthreads

We could only use @found_map_block to find free blocks
after we have collectd all used blocks, so something like
handle_fs_bad_blocks(), ext2fs_create_resize_inode(),
e2fsck_pass1_dupblocks() really should be handled after
all threads has been finished.

E2fsprogs-commit: 6b1d459bf6018eea7ff0a0ae6b555276718dcda3

Change-Id: Ibdbaed3d218623daa0baec31837037d773799262
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: serialize fix operations
Wang Shilong [Fri, 6 Mar 2020 08:46:47 +0000 (16:46 +0800)]
e2fsck: serialize fix operations

Allow different threads to fix at the same time could
be dangerous and error-prone now, and most of time
parallel scanning and checking is important.

So this patch adds a mutex to serialize
fix operations during pass1.

And the good benefit of this, we don't need block
allocations and free, superblock updates protection
any more, since only fix operations during pass1
could touch them.

E2fsprogs-commit: 5485120b668c952b6e83f24a1e1a74eaa7bf362e

Change-Id: Iedb64545240cc9325dc0c4ce737a970b27f4f3f6
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge quota context after threads finish
Wang Shilong [Fri, 6 Mar 2020 15:08:07 +0000 (23:08 +0800)]
e2fsck: merge quota context after threads finish

Every threads calculate its own quota accounting,
merge them after threads finish.

E2fsprogs-commit: a0af18577fbb960eb20695afbb4af4e23b864909

Change-Id: If9f0e17e560715ed55183f85c443f21ebbce7d40
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge context flags properly
Wang Shilong [Mon, 24 Feb 2020 05:08:58 +0000 (13:08 +0800)]
e2fsck: merge context flags properly

e2fsck might restart after pass1, so we should keep
flags if possible, this patch try to fix f_illitable_flexbg failure

E2fsprogs-commit: c36fa1b28bd4171f53ab4f89a90f6b3b8bf80fd2

Change-Id: I6dda1520a2ff6255d244461af75d7609f47ba92b
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge dirs_to_hash when threads finish
Wang Shilong [Mon, 24 Feb 2020 04:44:06 +0000 (12:44 +0800)]
e2fsck: merge dirs_to_hash when threads finish

@dirs_to_hash list need be merged after threads finish,
test covered by t_dangerous.

E2fsprogs-commit: e2db6c19943065909c11af3b03c2904c35e5e4f8

Change-Id: I99b44c40afa22ce8e4530c874b077493cf969e03
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge dx_dir_info after threads finish
Wang Shilong [Fri, 6 Dec 2019 15:37:53 +0000 (23:37 +0800)]
e2fsck: merge dx_dir_info after threads finish

Merge properly.

E2fsprogs-commit: 45519b8167a00979e86d5a5aa95d0bfb07f72520

Change-Id: Ifaed7a0022b716c42df908327c41aaaaa39aa365
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge fs flags when threads finish
Li Xi [Sun, 8 Sep 2019 08:15:35 +0000 (16:15 +0800)]
e2fsck: merge fs flags when threads finish

merge fs flags properly.

E2fsprogs-commit: d4c0519725d59c9380acc828d24bc070c5bc2c03

Change-Id: I80c773bebc0e321bf2fe3b436c3f0e601b1f1b79
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge counts after threads finish
Wang Shilong [Tue, 22 Sep 2020 13:14:39 +0000 (21:14 +0800)]
e2fsck: merge counts after threads finish

Merge counts properly.

E2fsprogs-commit: 057060ccabf9b5b47afe435d90a1f7f68c03a231

Change-Id: Ieace889f0d1a20a1990424113b0e8fc81f945266
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: add debug codes for multiple threads
Li Xi [Thu, 5 Sep 2019 11:40:36 +0000 (19:40 +0800)]
e2fsck: add debug codes for multiple threads

These debug codes are added to run the multiple pass1 check
thread one by one in order. If all the codes are correct,
fsck of multiple threads should have exactly the same outcome
with single thread.

E2fsprogs-commit: a8b483a1e7987a6dddc32bc82db06f649d245630

Change-Id: I41b0493a0cd830b76434ff0f86a87c98d8d3ad22
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge dblist after thread finishes
Li Xi [Thu, 5 Sep 2019 08:30:40 +0000 (16:30 +0800)]
e2fsck: merge dblist after thread finishes

Merge dblist properly.

E2fsprogs-commit: f3c2256490297201c63139ba0fea5c6b09bca3cf

Change-Id: Ifd907035ed9762c446c688ccc5af3f3fcaa52d24
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge icounts after thread finishes
Li Xi [Wed, 4 Sep 2019 10:47:14 +0000 (18:47 +0800)]
e2fsck: merge icounts after thread finishes

Merge inode_count and inode_link_info properly after
threads finish.

E2fsprogs-commit: bb78742b5e2e95c3e7e9a76755144fdf8ec12285

Change-Id: If40930a87595010963fd59a54709a4d2b27d223b
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge badblocks after thread finishes
Wang Shilong [Tue, 22 Sep 2020 10:00:39 +0000 (18:00 +0800)]
e2fsck: merge badblocks after thread finishes

Badblocks should be merged properly after threads finish.

E2fsprogs-commit: f39197f53ef5d90cd6952d7e75f2d2e3a02bf7ef

Change-Id: Ieb9a96a5e4438270ba6e939155e2666bb53177e4
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: rbtree bitmap for dir
Wang Shilong [Mon, 21 Sep 2020 11:02:33 +0000 (19:02 +0800)]
e2fsck: rbtree bitmap for dir

Only rbtree support merge operation now, use it for bitmaps.

E2fsprogs-commit: 9bab3284e30752bccc36be3e07b9ca4dfd218041

Change-Id: I42aeb009ece78a4baf4369aff3355fc9df51089a
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge dir_info after thread finishes
Li Xi [Mon, 2 Sep 2019 08:14:38 +0000 (16:14 +0800)]
e2fsck: merge dir_info after thread finishes

dir_info need be merged after thread finish.

E2fsprogs-commit: fdbf5e226cf931a5713414001b95e4697997a464

Change-Id: I7e33c0035ec8c6bfa7c13d759e3edb468634eae3
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: optimize the inserting of dir_info_db
Li Xi [Fri, 30 Aug 2019 09:56:10 +0000 (17:56 +0800)]
e2fsck: optimize the inserting of dir_info_db

Binary search is now used when inserting an dir info to the array.
Memmove is now used when moving array. Both of them improves
the performance of inserting.

This patch is also a prepartion for the merging of two dir db
arrays.

E2fsprogs-commit: 13d3c76475d050941d244c85cbb9256ffd980f88

Change-Id: I69041084dbd7e36eefa44744c3fb3737af8e906e
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: do not change global variables
Li Xi [Fri, 30 Aug 2019 04:20:11 +0000 (12:20 +0800)]
e2fsck: do not change global variables

Global variables used in pass1 check are changed to local variables
in this patch. This will avoid conflict between threads.

E2fsprogs-commit: 5a1b22da5ca3e90728cee1dbe6bc1920b245dded

Change-Id: Ifc682874801af15e8e13764832ca569b7da4ac57
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: merge bitmaps after thread completes
Wang Shilong [Wed, 23 Sep 2020 03:17:29 +0000 (11:17 +0800)]
e2fsck: merge bitmaps after thread completes

A new method merge_bmap has been added to bitmap operations. But
only red-black bitmap has that operation now.

E2fsprogs-commit: ecf85fb474fb7537f14bddd8f85d8372b808d5e9

Change-Id: Id5c387dd813d633adff3afb9208213086c33b6d2
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 years agoe2fsck: print thread log properly
Li Xi [Mon, 26 Aug 2019 14:34:06 +0000 (22:34 +0800)]
e2fsck: print thread log properly

When multi-thread fsck is enabled, logs printed from multiple
threads could overlap with each other. The overlap sometimes
makes the logs unreadable because log_out() is used multiple times
for a single line.

This patch adds leading [Thread XXX] to each logs if multi-thread
is enabed by -m option.

This patch also adds message to show the group ranges and inode
numbers for each thread, which is useful for debuging multi-thread
check.

E2fsprogs-commit: 5b071ed80deca2cdc87585a673076529dd47ca6e

Change-Id: I4bd08bc48813a399ab3a79130ff159b12d22f3a0
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>