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

EOPNOTSUPP, ENOTSUPP, ENOTSUP confusion

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Lustre 2.14.0, Lustre 2.15.0
    • Labels:
      None
    • Severity:
      3
    • Rank (Obsolete):
      9223372036854775807

      Description

      llmv tries posix_fallocate() and falls back to ftruncate() if it indicates that the operation is not supported. From llvm-project-llvmorg-11.0.0/llvm/lib/Support/Unix/Path.inc:

      std::error_code resize_file(int FD, uint64_t Size) {
      #if defined(HAVE_POSIX_FALLOCATE)
        // If we have posix_fallocate use it. Unlike ftruncate it always allocates                                            
        // space, so we get an error if the disk is full.                                                                     
        if (int Err = ::posix_fallocate(FD, 0, Size)) {
      #ifdef _AIX
          constexpr int NotSupportedError = ENOTSUP;
      #else
          constexpr int NotSupportedError = EOPNOTSUPP;
      #endif
          if (Err != EINVAL && Err != NotSupportedError)
            return std::error_code(Err, std::generic_category());
        }
      #endif
        // Use ftruncate as a fallback. It may or may not allocate space. At least on                                         
        // OS X with HFS+ it does.                                                                                            
        if (::ftruncate(FD, Size) == -1)
          return std::error_code(errno, std::generic_category());
      
        return std::error_code();
      }
      

      Somewhere on the server side OST_FALLOCATE is failing and we are returning ENOTSUPP but we should be returning EOPNOTSUPP.

      Note:

      ENOTSUPP is 524 and defined only in the kernel errno.h and is a NFSv3 specific errno.

      EOPNOTSUPP (95) is defined in kernel and userspace errno.h.

      ENOTSUP is defined in userspace errno.h as an alias for EOPNOTSUPP.

      Ideally we should change every ENOTSUPP to EOPNOTSUPP and add a checkpatch warning. (Or almost every if there's some real NFSv3 interaction.)

        Attachments

          Activity

            People

            • Assignee:
              jhammond John Hammond
              Reporter:
              jhammond John Hammond
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: