[LU-2462] debugfs doesn't care about DIRENT_LUFID flag while inserting new entries Created: 11/Dec/12  Updated: 28/Aug/13  Resolved: 28/Aug/13

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

Type: Bug Priority: Critical
Reporter: Mikhail Pershin Assignee: Andreas Dilger
Resolution: Fixed Votes: 0
Labels: e2fsprogs, releases

Issue Links:
Related
is related to LU-838 "lfs path2fid /mnt/lustre" (ROOT) ret... Resolved
Severity: 3
Rank (Obsolete): 5806

 Description   

Directory entries with DIRENT_LUFID flag in d_type contains packed FID right after entry name, so they have longer rec_len. Debugfs doesn't check that when inserting new entry and corrupts directory.

debugfs:  cd ROOT
debugfs:  ls
 50039  (28) .    2  (28) ..    50041  (36) .lustre    104  (32) file-0   
 105  (32) file-1    106  (32) file-2    107  (32) file-3    108  (32) file-4   
 109  (32) file-5    110  (32) file-6    111  (32) file-7    112  (32) file-8   
 113  (3716) file-9   
debugfs:  rm file-2
debugfs:  write /etc/hosts file-2
Allocated inode: 50042
debugfs:  ls
 50039  (12) .    50042  (16) file-2    2  (28) ..    50041  (36) .lustre   
 104  (32) file-0    105  (64) file-1    107  (32) file-3    108  (32) file-4   
 109  (32) file-5    110  (32) file-6    111  (32) file-7    112  (32) file-8   
 113  (3716) file-9   

Note how rec_len of '.' is changed. Now let's mount lustre back:

[root@node7 tests]# ls /mnt/lustre
ls: reading directory /mnt/lustre: Input/output error

dmesg says:

LDISKFS-fs error (device loop0): htree_dirblock_to_tree: bad entry in directory #50039: rec_len is too small for name_len - block=12610offset=0(0), inode=50039, rec_len=12, name_len=1
Aborting journal on device loop0-8.
LDISKFS-fs (loop0): Remounting filesystem read-only


 Comments   
Comment by Manisha salve (Inactive) [ 02/May/13 ]

Added the changes to consider DIRENT_LUFID while writing new file.
Code review link is : http://review.whamcloud.com/#change,6237

Comment by Andreas Dilger [ 28/Aug/13 ]

Patch landed for master-lustre, will be in next release beyond 1.42.7.wc1.

Generated at Sat Feb 10 01:25:24 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.