Whamcloud - gitweb
e2fsck: track errors/badness found for each inode
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 13 Apr 2012 07:13:58 +0000 (01:13 -0600)
committerLi Dongyang <dongyangli@ddn.com>
Wed, 14 Apr 2021 05:18:40 +0000 (15:18 +1000)
commit8533d955f884f7b61d011a7c7d183a6c99db636b
treeb7b59101d3bbb3e3a63088a256933dee42b85f60
parent3f0e90cdaa159f91a4a35f66a38d5bca8744e582
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>
16 files changed:
e2fsck/e2fsck.8.in
e2fsck/e2fsck.c
e2fsck/e2fsck.h
e2fsck/pass1.c
e2fsck/pass1b.c
e2fsck/pass2.c
e2fsck/pass3.c
e2fsck/problem.c
e2fsck/problem.h
e2fsck/super.c
e2fsck/unix.c
lib/ext2fs/ext2fs.h
lib/ext2fs/icount.c
tests/f_messy_inode/expect.1
tests/f_messy_inode/expect.2
tests/f_messy_inode/script [new file with mode: 0644]