If we have a con that refs a pipe but it is closed, don't use it. If
the ref is still there, it is only because we are racing with fault()
and it is about to (or just was) be detached. Either way,
Signed-off-by: Sage Weil <sage@inktank.com>
}
void stop();
- void send(Message *m) {
- pipe_lock.Lock();
- _send(m);
- pipe_lock.Unlock();
- }
void _send(Message *m) {
out_q[m->get_priority()].push_back(m);
cond.Signal();
return;
}
if (pipe) {
- ldout(cct,20) << "submit_message " << *m << " remote, " << dest_addr << ", have pipe." << dendl;
- pipe->send(m);
+ pipe->pipe_lock.Lock();
+ if (pipe->state != Pipe::STATE_CLOSED) {
+ ldout(cct,20) << "submit_message " << *m << " remote, " << dest_addr << ", have pipe." << dendl;
+ pipe->_send(m);
+ pipe->pipe_lock.Unlock();
+ pipe->put();
+ return;
+ }
+ pipe->pipe_lock.Unlock();
pipe->put();
- return;
+ ldout(cct,20) << "submit_message " << *m << " remote, " << dest_addr
+ << ", had pipe " << pipe << ", but it closed." << dendl;
}
}