[LU-11545] debugfs: "ncheck -c" does not work correctly Created: 18/Oct/18  Updated: 24/Feb/22  Resolved: 09/Apr/21

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.12.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Andreas Dilger Assignee: Dongyang Li
Resolution: Fixed Votes: 0
Labels: e2fsprogs

Issue Links:
Related
is related to LU-11446 ldiskfs inodes nlink mismatch with DNE Open
is related to LU-11440 Make e2fsprogs-1.44.3-wc1 release Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

I noticed when investigating LU-11446 that debugfs is unhappy about the file type stored in the directory (verified if the "-c" option is used):

debugfs -c /dev/loop0
debugfs 1.44.3.wc1
debugfs: ncheck -c 164
Inode   Pathname
164     /REMOTE_PARENT_DIR/0x200000204:0x1:0x0   <--- BAD FILETYPE
debugfs: ls -l /REMOTE_PARENT_DIR
:
:
    164  100644 (17)      0      0       0 

However, it appears the same problem is true for other directories, so it is not an issue with REMOTE_PARENT_DIR. I suspect it is instead a problem that ncheck -c is not masking off the dirdata flags from the filetype.

Also, it looks like the usage message for "ls" is not including the "-D" option to print the dirdata fields.



 Comments   
Comment by Andreas Dilger [ 18/Oct/18 ]

There is a separate problem that "ncheck" does not return all of the links to a file, but that will be fixed in e2fsprogs-1.44.4 via commit:

commit 4a30e2ae7ced039189ee438065b2f656d83e7e44
Author:     Jaco Kroon <jaco@uls.co.za>
AuthorDate: Thu Aug 2 20:06:46 2018 +0200

    debugfs: fix ncheck so it handles hard links correctly
    
    Due to hard links inodes can have multiple names (except for folders),
    ncheck should find all of the names (equal to the number of links to the
    inodes, directories excepted), not names to the count of the provided
    inodes.
    
    Signed-off-by: Jaco Kroon <jaco@uls.co.za>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Comment by Dongyang Li [ 19/Oct/18 ]

I just tested with the old 1.42.13-wc6 seems the problem is worse:

debugfs 1.42.13.wc6 (05-Feb-2017)
debugfs:  ncheck -c 1048587
Inode Pathname1048587 /ROOT/testdir/1  <--- BAD FILETYPE
Segmentation fault

ideally the fix and ls -D option along with man page changes should be part of the dirdata patch,

should we rebase to 1.44.4 to include 4a30e2ae7ced039189ee438065b2f656d83e7e44 also we can drop

fddc423dc6353552772969d70cec08e8378d8e57 Fix compile error and warnings for old gcc versions which got into 1.44.4? The dirdata patch can be fixed during the rebase.

Comment by Andreas Dilger [ 19/Oct/18 ]

Rebasing to 1.44.4 would also be good, and including the fix into the dirdata patch would also be good.

Comment by Dongyang Li [ 19/Oct/18 ]

Just created master-lustre-test branch again, it's the 1.44.4 with the fixed up dirdata patch and everything else.

make fullcheck looks good.

Comment by Gerrit Updater [ 05/Nov/18 ]

Li Dongyang (dongyangli@ddn.com) uploaded a new patch: https://review.whamcloud.com/33574
Subject: LU-11545 debugfs: mask off dir_data flags for ncheck
Project: tools/e2fsprogs
Branch: master-lustre
Current Patch Set: 1
Commit: b3c19d01c64ab6046d28a671d33d7e2ddb40387c

Comment by Dongyang Li [ 05/Nov/18 ]

I've noticed a bunch of patches on gerrit for master-lustre, so let's also track the patches for master-lustre branch. I will note which patches are needed when we move the 1.44.4 or when 1.44.5 is released.

Comment by Gerrit Updater [ 09/Nov/18 ]

Andreas Dilger (adilger@whamcloud.com) merged in patch https://review.whamcloud.com/33574/
Subject: LU-11545 debugfs: mask off dir_data flags for ncheck
Project: tools/e2fsprogs
Branch: master-lustre
Current Patch Set:
Commit: 97a5284dec2336fef87482ba3509c7ba6353c678

Comment by Andreas Dilger [ 09/Apr/21 ]

This was fixed in 1.44.3-wc1

Comment by Gerrit Updater [ 24/Feb/22 ]

"Andreas Dilger <adilger@whamcloud.com>" merged in patch https://review.whamcloud.com/44388/
Subject: LU-11545 debugfs: allow <inode> for ncheck
Project: tools/e2fsprogs
Branch: master-lustre
Current Patch Set:
Commit: b15a0ad2fb8703c87dedcf0b2af26e3e750bcb76

Generated at Sat Feb 10 02:44:48 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.