[sheepdog] [Qemu-devel] [PATCH] sheepdog: fix loadvm operation

Stefan Hajnoczi stefanha at gmail.com
Wed Apr 24 16:53:50 CEST 2013


On Wed, Apr 24, 2013 at 05:46:41PM +0800, Liu Yuan wrote:
> +/* Delete current working VDI by the name */
> +static int sd_delete(BDRVSheepdogState *s, char *name)
> +{
> +    unsigned int wlen = SD_MAX_VDI_LEN;
> +    SheepdogVdiReq hdr = {
> +        .opcode = SD_OP_DEL_VDI,
> +        .vdi_id = s->inode.vdi_id,
> +        .data_length = wlen,
> +        .flags = SD_FLAG_CMD_WRITE,
> +    };
> +    SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;
> +    int fd, ret;
> +
> +    fd = connect_to_sdog(s);
> +    if (fd < 0) {
> +        return fd;
> +    }
> +
> +    ret = send_co_req(fd, (SheepdogReq *)&hdr, name, &wlen);

This is a coroutine function, it may yield.  It seems sd_delete() and
sd_snapshot_goto() are not coroutine functions, so this call is not
allowed.

You'll see a crash if the socket I/O returns EAGAIN.  Then
qemu_coroutine_yield() will abort.



More information about the sheepdog mailing list