Skip to content

Commit

Permalink
include/seastar/gate: re-enable SEASTAR_GATE_HOLDER_DEBUG and fix rac…
Browse files Browse the repository at this point in the history
…e condition during gate debug
  • Loading branch information
NitzanMordhai committed Jul 29, 2024
1 parent e7a2679 commit 081d9a0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/seastar/core/gate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
#include <seastar/util/modules.hh>
#include <cassert>
#include <exception>
#include <mutex>
#include <optional>
#include <utility>
#endif

#ifdef SEASTAR_DEBUG
// See: https://tracker.ceph.com/issues/64332
// #define SEASTAR_GATE_HOLDER_DEBUG
#define SEASTAR_GATE_HOLDER_DEBUG
#endif

namespace seastar {
Expand Down Expand Up @@ -174,14 +174,17 @@ public:
#ifdef SEASTAR_GATE_HOLDER_DEBUG
using member_hook_t = boost::intrusive::list_member_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>;
member_hook_t _link;
std::mutex _debug_mutex;

void debug_hold_gate() noexcept {
if (_g) {
std::lock_guard<std::mutex> lock(_debug_mutex);
_g->_holders.push_back(*this);
}
}

void debug_release_gate() noexcept {
seastar::lock_guard<seastar::mutex> lock(_debug_mutex);
_link.unlink();
}
#else // SEASTAR_GATE_HOLDER_DEBUG
Expand Down

0 comments on commit 081d9a0

Please sign in to comment.