Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-2462

debugfs doesn't care about DIRENT_LUFID flag while inserting new entries

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • None
    • None
    • 3
    • 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
      

      Attachments

        Issue Links

          Activity

            People

              adilger Andreas Dilger
              tappro Mikhail Pershin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: