mirror of
https://github.com/ceph/ceph
synced 2025-01-20 18:21:57 +00:00
objecter: remove dead race handling code
The only caller of _get_osd_session() holds rwlock for write, so _get_session() cannot race. The only caller of _get_session() which may possibly race is _op_submit(), which handles the race more simply inline. Call _get_session() inline in place of _get_osd_session(), and remove the unused functions _get_osd_session() and _promote_lock_check_race(). Signed-off-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
parent
1b2da9b949
commit
a60d5fab0b
@ -2624,31 +2624,6 @@ void Objecter::_session_command_op_assign(OSDSession *to, CommandOp *op)
|
||||
ldout(cct, 15) << __func__ << " " << to->osd << " " << op->tid << dendl;
|
||||
}
|
||||
|
||||
int Objecter::_get_osd_session(int osd, RWLock::Context& lc, OSDSession **psession)
|
||||
{
|
||||
int r;
|
||||
do {
|
||||
r = _get_session(osd, psession, lc);
|
||||
if (r == -EAGAIN) {
|
||||
assert(!lc.is_wlocked());
|
||||
|
||||
if (!_promote_lock_check_race(lc)) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
} while (r == -EAGAIN);
|
||||
assert(r == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Objecter::_promote_lock_check_race(RWLock::Context& lc)
|
||||
{
|
||||
epoch_t epoch = osdmap->get_epoch();
|
||||
lc.promote();
|
||||
return (epoch == osdmap->get_epoch());
|
||||
}
|
||||
|
||||
int Objecter::_recalc_linger_op_target(LingerOp *linger_op, RWLock::Context& lc)
|
||||
{
|
||||
assert(rwlock.is_wlocked());
|
||||
@ -2659,13 +2634,9 @@ int Objecter::_recalc_linger_op_target(LingerOp *linger_op, RWLock::Context& lc)
|
||||
<< " pgid " << linger_op->target.pgid
|
||||
<< " acting " << linger_op->target.acting << dendl;
|
||||
|
||||
OSDSession *s;
|
||||
r = _get_osd_session(linger_op->target.osd, lc, &s);
|
||||
if (r < 0) {
|
||||
// We have no session for the new destination for the op, so leave it
|
||||
// in this session to be handled again next time we scan requests
|
||||
return r;
|
||||
}
|
||||
OSDSession *s = NULL;
|
||||
r = _get_session(linger_op->target.osd, &s, lc);
|
||||
assert(r == 0);
|
||||
|
||||
if (linger_op->session != s) {
|
||||
// NB locking two sessions (s and linger_op->session) at the same time here
|
||||
|
@ -1741,7 +1741,6 @@ public:
|
||||
void _session_command_op_assign(OSDSession *to, CommandOp *op);
|
||||
void _session_command_op_remove(OSDSession *from, CommandOp *op);
|
||||
|
||||
int _get_osd_session(int osd, RWLock::Context& lc, OSDSession **psession);
|
||||
int _assign_op_target_session(Op *op, RWLock::Context& lc, bool src_session_locked, bool dst_session_locked);
|
||||
int _recalc_linger_op_target(LingerOp *op, RWLock::Context& lc);
|
||||
|
||||
@ -1929,7 +1928,6 @@ private:
|
||||
int pool_snap_get_info(int64_t poolid, snapid_t snap, pool_snap_info_t *info);
|
||||
int pool_snap_list(int64_t poolid, vector<uint64_t> *snaps);
|
||||
private:
|
||||
bool _promote_lock_check_race(RWLock::Context& lc);
|
||||
|
||||
// low-level
|
||||
ceph_tid_t _op_submit(Op *op, RWLock::Context& lc);
|
||||
|
Loading…
Reference in New Issue
Block a user