Skip to content

osd: fix C++20 atomic deprecation warnings #60802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

chardan
Copy link
Contributor

@chardan chardan commented Nov 23, 2024

gcc14 issues warnings about C++11 atomic features that were deprecated in C++20. This
patch migrates the types involved to atomic<shared_ptr<>> to resolve this.

note:
Does NOT patch for WITH_SEASTAR=ON.

refer-to:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2869r0.pdf

Fixes: https://tracker.ceph.com/issues/69026

Signed-off-by: Jesse F. Williamson [email protected]

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@github-actions github-actions bot added the core label Nov 23, 2024
atomic<shared_ptr>.

Does NOT include Seastar patches.

Signed-off-by: Jesse F. Williamson <[email protected]>
@chardan chardan force-pushed the jfw-gcc14-fixup-deprecated-atomic branch from a294ae8 to 2ff9748 Compare November 23, 2024 02:49
Copy link
Contributor

@Matan-B Matan-B left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding WITH_SEASTAR, it depends on the case. Given that the change here is general and not Classical OSD specific, I think that we should also adjust Crimson's relevant users (if any).

@cbodley
Copy link
Contributor

cbodley commented Nov 25, 2024

unfortunately, we're currently stuck supporting gcc 11 which doesn't have atomic shared ptr yet:

include/c++/11/atomic:211:7: error: static_assert failed due to requirement '__is_trivially_copyable(std::shared_ptr<const OSDMap>)' "std::atomic requires a trivially copyable type"
      static_assert(__is_trivially_copyable(_Tp),
      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

this came up recently in #60225, where we needed ifdefs for gcc version

@chardan
Copy link
Contributor Author

chardan commented Nov 25, 2024

Ah, shucks! That complicates this. We /could/ work around it with what amount to a wrapper for atomic_store() that does a capability check (#if __cpp_lib_atomic_shared_ptr), but unless we're doing it project wide (and that seems like somewhat pointless effort as the "right" solution is to move to atomic<shared_ptr<>>) I feel like it adds quite a bit of complexity to an already trickier-than-it-looks[1] bit of code. Perhaps it's best to let this one be for now.

  1. Noticing that OSDMap.h (1838) has its /own/ Seastar ifdef of OSDMapRef for the global namespace, which is different than the PastIntervals::OSDMapRef appearing in osd_types.h, and looking at the way the tests use it, it becomes curious that the overload interval_rep::check_new_interval() appears to only be there FOR wrangling the atomic types... to pass the values into a function that doesn't do atomic checks. I get a bit unclear on what was actually intended .

@chardan
Copy link
Contributor Author

chardan commented Nov 25, 2024

Closing this for now-- it will make more sense to address once we can drop support for GCC11.

See-also: https://lists.ceph.io/hyperkitty/list/[email protected]/thread/LNMXUFBMFXHIXX334DYOMW5K4PYN4YIM/

@chardan chardan closed this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants