[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH 10/17] tools: block-remus: fix bug in ctl_request()
On Oct 13, 2014 10:13 PM, "Wen Congyang" <wency@xxxxxxxxxxxxxx> wrote:
>
> ctl_request() handles the command which the users writes to ctl fifo. The
> user will read the response from msg fifo. This patch fixes the following bugs:
> 1. If the command is not "flush", we don't respond, and the user will wait
> Â Âthe forever.
> 2. If the current mode is not mode_primary, we don't respond in s->queue_flush(),
> Â Âso call s->queue_flush() only if the mode is mode_primary.
>
> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
> Cc: Shriram Rajagopalan <rshriram@xxxxxxxxx>
> ---
> Âtools/blktap2/drivers/block-remus.c | 7 ++++++-
> Â1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/blktap2/drivers/block-remus.c b/tools/blktap2/drivers/block-remus.c
> index 55363a3..9be47f6 100644
> --- a/tools/blktap2/drivers/block-remus.c
> +++ b/tools/blktap2/drivers/block-remus.c
> @@ -1513,13 +1513,18 @@ static void ctl_request(event_id_t id, char mode, void *private)
> Â Â Â Â /* TODO: need to get driver somehow */
> Â Â Â Â msg[rc] = '\0';
> Â Â Â Â if (!strncmp(msg, "flush", 5)) {
> -Â Â Â Â Â Â Â Âif (s->queue_flush)
> +Â Â Â Â Â Â Â Âif (s->mode == mode_primary) {
> Â Â Â Â Â Â Â Â Â Â Â Â if ((rc = s->queue_flush(driver))) {
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â RPRINTF("error passing flush request to backup");
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ctl_respond(s, TDREMUS_FAIL);
> Â Â Â Â Â Â Â Â Â Â Â Â }
> +Â Â Â Â Â Â Â Â} else {
> +Â Â Â Â Â Â Â Â Â Â Â ÂRPRINTF("We are not in primary mode\n");
> +Â Â Â Â Â Â Â Â Â Â Â Âctl_respond(s, TDREMUS_FAIL);
> +Â Â Â Â Â Â Â Â}
> Â Â Â Â } else {
> Â Â Â Â Â Â Â Â RPRINTF("unknown command: %s\n", msg);
> +Â Â Â Â Â Â Â Âctl_respond(s, TDREMUS_FAIL);
> Â Â Â Â }
> Â}
>
> --
> 1.9.3
>
Acked-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|