Merge pull request #4099 from rajukv/xio-bugfix

XIO: Handle queued incoming XIO messages during retry

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2015-03-24 11:31:53 +08:00
commit 8dd9f6a4ed
2 changed files with 33 additions and 10 deletions

View File

@ -539,12 +539,23 @@ int XioConnection::discard_input_queue(uint32_t flags)
for (ix = 0; ix < q_size; ++ix) {
XioSubmit::Queue::iterator q_iter = deferred_q.begin();
XioSubmit* xs = &(*q_iter);
assert(xs->type == XioSubmit::OUTGOING_MSG);
XioMsg* xmsg = static_cast<XioMsg*>(xs);
deferred_q.erase(q_iter);
// release once for each chained xio_msg
for (ix = 0; ix < int(xmsg->hdr.msg_cnt); ++ix)
xmsg->put();
XioMsg* xmsg;
switch (xs->type) {
case XioSubmit::OUTGOING_MSG:
xmsg = static_cast<XioMsg*>(xs);
deferred_q.erase(q_iter);
// release once for each chained xio_msg
for (ix = 0; ix < int(xmsg->hdr.msg_cnt); ++ix)
xmsg->put();
break;
case XioSubmit::INCOMING_MSG_RELEASE:
deferred_q.erase(q_iter);
portal->release_xio_rsp(static_cast<XioRsp*>(xs));
break;
default:
ldout(msgr->cct,0) << __func__ << ": Unknown Msg type " << xs->type << dendl;
break;
}
}
return 0;

View File

@ -213,9 +213,10 @@ public:
while (q_iter != send_q.end()) {
XioSubmit *xs = &(*q_iter);
// skip retires and anything for other connections
if ((xs->type != XioSubmit::OUTGOING_MSG) ||
(xs->xcon != xcon))
if (xs->xcon != xcon) {
q_iter++;
continue;
}
xmsg = static_cast<XioMsg*>(xs);
q_iter = send_q.erase(q_iter);
requeue_q.push_back(*xmsg);
@ -283,8 +284,19 @@ public:
print_ceph_msg(msgr->cct, "xio_send_msg", xmsg->m);
}
/* get the right Accelio's errno code */
if (unlikely(code))
code = xio_errno();
if (unlikely(code)) {
if ((code == -1) && (xio_errno() == -1)) {
/* In case XIO does not have any credits to send,
* it would still queue up the message(s) for transmission,
* but would return -1 and errno would also be set to -1.
* This needs to be treated as a success.
*/
code = 0;
}
else {
code = xio_errno();
}
}
} /* !ENOTCONN */
if (unlikely(code)) {
switch (code) {