ldout(cct, 10) << __func__ << " " << info->linger_id << " = " << r
<< " (last_error " << info->last_error << ")" << dendl;
if (r < 0) {
- info->watch_lock.Lock();
+ info->watch_lock.get_write();
info->last_error = r;
- info->watch_cond.Signal();
if (info->watch_context)
finisher->queue(new C_DoWatchError(info, r));
- info->watch_lock.Unlock();
+ info->watch_lock.put_write();
}
}
<< " sent " << sent << " gen " << register_gen << " = " << r
<< " (last_error " << info->last_error
<< " register_gen " << info->register_gen << ")" << dendl;
- info->watch_lock.Lock();
+ info->watch_lock.get_write();
if (info->register_gen == register_gen) {
if (r == 0) {
info->watch_valid_thru = sent;
if (info->watch_context)
finisher->queue(new C_DoWatchError(info, r));
}
- info->watch_cond.SignalAll();
} else {
ldout(cct, 20) << " ignoring old gen" << dendl;
}
- info->watch_lock.Unlock();
+ info->watch_lock.put_write();
}
int Objecter::linger_check(LingerOp *info)
{
- RWLock::WLocker wl(rwlock);
- Mutex::Locker l(info->watch_lock);
+ RWLock::RLocker l(info->watch_lock);
utime_t stamp = info->watch_valid_thru;
if (!info->watch_pending_async.empty())
bool is_watch;
utime_t watch_valid_thru; ///< send time for last acked ping
int last_error; ///< error from last failed ping|reconnect, if any
- Mutex watch_lock;
- Cond watch_cond;
+ RWLock watch_lock;
// queue of pending async operations, with the timestamp of
// when they were queued.
epoch_t map_dne_bound;
void queued_async() {
- Mutex::Locker l(watch_lock);
+ RWLock::WLocker l(watch_lock);
watch_pending_async.push_back(ceph_clock_now(NULL));
}
void finished_async() {
- Mutex::Locker l(watch_lock);
+ RWLock::WLocker l(watch_lock);
assert(!watch_pending_async.empty());
watch_pending_async.pop_front();
}