Merge remote-tracking branch 'bonzini/nbd-next' into staging
# By Stefan Hajnoczi # Via Paolo Bonzini * bonzini/nbd-next: nbd: set TCP_NODELAY nbd: use TCP_CORK in nbd_co_send_request() nbd: unlock mutex in nbd_co_send_request() error path Message-id: 1366381830-11267-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
commit
25690739f1
25
block/nbd.c
25
block/nbd.c
|
@ -334,13 +334,23 @@ static int nbd_co_send_request(BDRVNBDState *s, struct nbd_request *request,
|
||||||
s->send_coroutine = qemu_coroutine_self();
|
s->send_coroutine = qemu_coroutine_self();
|
||||||
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, nbd_restart_write,
|
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, nbd_restart_write,
|
||||||
nbd_have_request, s);
|
nbd_have_request, s);
|
||||||
rc = nbd_send_request(s->sock, request);
|
if (qiov) {
|
||||||
if (rc >= 0 && qiov) {
|
if (!s->is_unix) {
|
||||||
ret = qemu_co_sendv(s->sock, qiov->iov, qiov->niov,
|
socket_set_cork(s->sock, 1);
|
||||||
offset, request->len);
|
|
||||||
if (ret != request->len) {
|
|
||||||
return -EIO;
|
|
||||||
}
|
}
|
||||||
|
rc = nbd_send_request(s->sock, request);
|
||||||
|
if (rc >= 0) {
|
||||||
|
ret = qemu_co_sendv(s->sock, qiov->iov, qiov->niov,
|
||||||
|
offset, request->len);
|
||||||
|
if (ret != request->len) {
|
||||||
|
rc = -EIO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!s->is_unix) {
|
||||||
|
socket_set_cork(s->sock, 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rc = nbd_send_request(s->sock, request);
|
||||||
}
|
}
|
||||||
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL,
|
qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL,
|
||||||
nbd_have_request, s);
|
nbd_have_request, s);
|
||||||
|
@ -396,6 +406,9 @@ static int nbd_establish_connection(BlockDriverState *bs)
|
||||||
sock = unix_socket_outgoing(qemu_opt_get(s->socket_opts, "path"));
|
sock = unix_socket_outgoing(qemu_opt_get(s->socket_opts, "path"));
|
||||||
} else {
|
} else {
|
||||||
sock = tcp_socket_outgoing_opts(s->socket_opts);
|
sock = tcp_socket_outgoing_opts(s->socket_opts);
|
||||||
|
if (sock >= 0) {
|
||||||
|
socket_set_nodelay(sock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Failed to establish connection */
|
/* Failed to establish connection */
|
||||||
|
|
Loading…
Reference in a new issue