ExportXMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: Lustre 2.17.0
    • None
    • 3
    • 9223372036854775807

      cl_mode_user_to_kernel() function is declared as returning an enum which is an unsigned integer type, as such returning negative values is bad:

      static enum cl_lock_mode cl_mode_user_to_kernel(enum lock_mode_user mode)
      {
              switch (mode) {
              case MODE_READ_USER:
                      return CLM_READ;
              case MODE_WRITE_USER:
                      return CLM_WRITE;
              default:
                      return -EINVAL;
              }
      }
      

      Further checks like this would be always false too:

              enum cl_lock_mode cl_mode;
      
              cl_mode = cl_mode_user_to_kernel(ladvise->lla_lockahead_mode);
              if (cl_mode < 0)
                      GOTO(out, result = cl_mode);
      

      Introduced in https://review.whamcloud.com/13564

            Assignee:
            Patrick Farrell
            Reporter:
            Oleg Drokin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: