qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v6 18/27] monitor: send event when command queue f


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC v6 18/27] monitor: send event when command queue full
Date: Tue, 9 Jan 2018 13:42:08 +0000
User-agent: Mutt/1.9.1 (2017-09-22)

On Tue, Dec 19, 2017 at 04:45:48PM +0800, Peter Xu wrote:
> @@ -4071,6 +4073,9 @@ static void handle_qmp_command(JSONMessageParser 
> *parser, GQueue *tokens)
>      req_obj->req = req;
>      req_obj->need_resume = false;
>  
> +    /* Protect qmp_requests and fetching its length. */
> +    qemu_mutex_lock(&mon->qmp.qmp_queue_lock);
> +
>      /*
>       * If OOB is not enabled on current monitor, we'll emulate the old
>       * behavior that we won't process current monitor any more until
> @@ -4080,6 +4085,17 @@ static void handle_qmp_command(JSONMessageParser 
> *parser, GQueue *tokens)
>      if (!qmp_oob_enabled(mon)) {
>          monitor_suspend(mon);
>          req_obj->need_resume = true;
> +    } else {
> +        /* Drop the request if queue is full. */
> +        if (mon->qmp.qmp_requests->length >= QMP_REQ_QUEUE_LEN_MAX) {
> +            qapi_event_send_command_dropped(id,
> +                                            COMMAND_DROP_REASON_QUEUE_FULL,
> +                                            NULL);
> +            qobject_decref(id);
> +            qobject_decref(req);
> +            g_free(req_obj);
> +            return;

qmp_queue_lock is still locked!  I suggest releasing the lock before
calling qapi_event_send_command_dropped().

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]