}
// sl may be unlocked.
-void Objecter::_check_op_pool_dne(Op *op, std::unique_lock<ceph::shared_mutex> *sl)
+void Objecter::_check_op_pool_dne(Op *op, std::unique_lock<std::shared_mutex> *sl)
{
// rwlock is locked unique
if (linger_op->session != s) {
// NB locking two sessions (s and linger_op->session) at the
// same time here is only safe because we are the only one that
- // takes two, and we are holding rwlock for write. Disable
- // lockdep because it doesn't know that.
+ // takes two, and we are holding rwlock for write. We use
+ // std::shared_mutex in OSDSession because lockdep doesn't know
+ // that.
unique_lock sl(s->lock);
_session_linger_op_remove(linger_op->session, linger_op);
_session_linger_op_assign(s, linger_op);
std::map<uint64_t,OSDBackoff*> backoffs_by_id;
int osd;
- ceph::shared_mutex lock;
+ // NB locking two sessions at the same time is only safe because
+ // it is only done in _recalc_linger_op_target with s and
+ // linger_op->session, and it holds rwlock for write. We disable
+ // lockdep (using std::sharedMutex) because lockdep doesn't know
+ // that.
+ std::shared_mutex lock;
int incarnation;
ConnectionRef con;
std::unique_ptr<std::mutex[]> completion_locks;
OSDSession(CephContext *cct, int o) :
- osd(o), lock(ceph::make_shared_mutex(
- fmt::format("OSDSession::lock #{}", o))),
- incarnation(0), con(NULL),
+ osd(o), incarnation(0), con(NULL),
num_locks(cct->_conf->objecter_completion_locks_per_session),
completion_locks(new std::mutex[num_locks]) {}
}
private:
- void _check_op_pool_dne(Op *op, std::unique_lock<ceph::shared_mutex> *sl);
+ void _check_op_pool_dne(Op *op, std::unique_lock<std::shared_mutex> *sl);
void _send_op_map_check(Op *op);
void _op_cancel_map_check(Op *op);
void _check_linger_pool_dne(LingerOp *op, bool *need_unregister);