[LU-14301] EOPNOTSUPP, ENOTSUPP, ENOTSUP confusion Created: 06/Jan/21  Updated: 14/Jul/23  Resolved: 12/Jan/21

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.14.0, Lustre 2.16.0, Lustre 2.15.0

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: John Hammond
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
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.)



 Comments   
Comment by Gerrit Updater [ 06/Jan/21 ]

John L. Hammond (jhammond@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/41148
Subject: LU-14301 llite: return EOPNOTSUPP if fallocate is not supported
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 51216ee83e1bc036e9e7bd19ede536d98cffb244

Comment by Gerrit Updater [ 12/Jan/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/41148/
Subject: LU-14301 llite: return EOPNOTSUPP if fallocate is not supported
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 71a9f5a466bfa46436535e3173d1fed37ca12aea

Comment by Peter Jones [ 12/Jan/21 ]

Landed for 2.14

Comment by Gerrit Updater [ 20/Jan/21 ]

John L. Hammond (jhammond@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/41280
Subject: LU-14301 lustre: add ENOTSUPP to spelling.txt
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: b161a8606b589da824c60702ac35e758ce45c9ca

Comment by Gerrit Updater [ 26/Feb/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/41280/
Subject: LU-14301 lustre: add ENOTSUPP to spelling.txt
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: e00733f0f87659c936039a58ea738cfb070638bc

Comment by Mahmoud Hanafi [ 21/Apr/22 ]

Is there a back port to 2.12. ?

Comment by Gerrit Updater [ 30/Jun/23 ]

"Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51511
Subject: LU-14301 client: use EOPNOTSUPP instead of ENOTSUPP
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 1a0d553000d5a869f9039bab74dbdbb20d4259b0

Comment by Gerrit Updater [ 14/Jul/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51511/
Subject: LU-14301 client: use EOPNOTSUPP instead of ENOTSUPP
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: ffd2fc1e17822c013d7790cc8247361c567792af

Generated at Sat Feb 10 03:08:33 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.