mirror of https://github.com/xemu-project/xemu.git
sheepdog: Avoid deadlock in error path
s->lock should be unlocked before leaving add_aio_request. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
28b77657cf
commit
c3fecea50d
|
@ -1116,6 +1116,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
|
||||||
/* send a header */
|
/* send a header */
|
||||||
ret = do_write(s->fd, &hdr, sizeof(hdr));
|
ret = do_write(s->fd, &hdr, sizeof(hdr));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
qemu_co_mutex_unlock(&s->lock);
|
||||||
error_report("failed to send a req, %s", strerror(errno));
|
error_report("failed to send a req, %s", strerror(errno));
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -1123,6 +1124,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
|
||||||
if (wlen) {
|
if (wlen) {
|
||||||
ret = do_writev(s->fd, iov, wlen, aio_req->iov_offset);
|
ret = do_writev(s->fd, iov, wlen, aio_req->iov_offset);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
qemu_co_mutex_unlock(&s->lock);
|
||||||
error_report("failed to send a data, %s", strerror(errno));
|
error_report("failed to send a data, %s", strerror(errno));
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue