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

mds returns EINVAL for hsm commands if fsname is 8-byte aligned

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • Lustre 2.6.0, Lustre 2.5.1
    • Lustre 2.5.0, Lustre 2.6.0
    • b2_5 and master have the same issue.
    • 3
    • 12885

    Description

      If a filesystem name is 8-byte aligned, all HSM commands will get -EINVALID. The root cause is in following code:

      /* Return pointer to first hai in action list */
      static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal)
      {
              return (struct hsm_action_item *)(hal->hal_fsname +
                                                cfs_size_round(strlen(hal-> \
                                                                      hal_fsname)));
      }
      

      hal_fsname is a string terminated with NULL. If strlen(hal->hal_fsname) is 8 aligned, hai_first() ends up eating the terminating NULL character.

      Now when the caller first time call hai_first() and set proper value to the returning first hsm_action_item, it ends up appending some non-NULL characters at the address of hal_fsname + strlen(hal_fsname). The side effect is that the next time someone calls hal_first(), strlen(hal->hal_fsname) is larger than the first time. That would result in misplacement of hsm_action_item and causes hal_is_sane() check to fail.

      Attachments

        Activity

          People

            jamesanunez James Nunez (Inactive)
            bergwolf Peng Tao
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: