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

server_ioctl uses LU_SEQ_RANGE_MDT wrongly

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • Lustre 2.17.0
    • Lustre 2.17.0
    • 3
    • 9223372036854775807

    Description

      smatch highlights that lustre/target/tgt_mount.c::server_ioctl() has this code:

                     err = obd_get_info(env, lsi->lsi_osd_exp, sizeof(KEY_FID2IDX),
                                        KEY_FID2IDX, &len, &u.fid);
                     if (err == 0) {
                             err = -EINVAL;
                             if (u.range.lsr_flags & LU_SEQ_RANGE_MDT)
                                     err = u.range.lsr_index;
      

      The problem is 

      #define LU_SEQ_RANGE_MDT  0x0

      so it never hits (introduced in https://review.whamcloud.com/c/fs/lustre-release/+/56339)

      Overall these values are definet as if they are the bits in a bitmask, but are never used as such which makes everything super confusing, so probably ripe for some rework?

      #define LU_SEQ_RANGE_MDT        0x0
      #define LU_SEQ_RANGE_OST        0x1
      #define LU_SEQ_RANGE_ANY        0x3
      #define LU_SEQ_RANGE_MASK       0x3
      

      For example:

       static inline unsigned fld_range_type(const struct lu_seq_range *range)
      {
              return range->lsr_flags & LU_SEQ_RANGE_MASK;
      }
      

      With the saving grace here being that all values are actually then explicitly compared.

       

      Attachments

        Issue Links

          Activity

            People

              wc-triage WC Triage
              green Oleg Drokin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: