qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode
@ 2016-02-04 10:19 Changlong Xie
  2016-02-04 12:24 ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Changlong Xie @ 2016-02-04 10:19 UTC (permalink / raw)
  To: qemu devel, Alberto Garcia, Kevin Wolf, Eric Blake; +Cc: Dr. David Alan Gilbert

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
 block/quorum.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/quorum.c b/block/quorum.c
index a5ae4b8..0965277 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -295,6 +295,9 @@ static void quorum_aio_cb(void *opaque, int ret)
             quorum_copy_qiov(acb->qiov, &acb->qcrs[acb->child_iter].qiov);
         }
         acb->vote_ret = ret;
+        if (ret < 0) {
+            acb->child_iter--;
+        }
         quorum_aio_finalize(acb);
         return;
     }
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode
  2016-02-04 10:19 [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode Changlong Xie
@ 2016-02-04 12:24 ` Kevin Wolf
  2016-02-05  1:57   ` Changlong Xie
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2016-02-04 12:24 UTC (permalink / raw)
  To: Changlong Xie; +Cc: Alberto Garcia, qemu devel, Dr. David Alan Gilbert

Am 04.02.2016 um 11:19 hat Changlong Xie geschrieben:
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
>  block/quorum.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/block/quorum.c b/block/quorum.c
> index a5ae4b8..0965277 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -295,6 +295,9 @@ static void quorum_aio_cb(void *opaque, int ret)
>              quorum_copy_qiov(acb->qiov, &acb->qcrs[acb->child_iter].qiov);
>          }
>          acb->vote_ret = ret;
> +        if (ret < 0) {
> +            acb->child_iter--;
> +        }
>          quorum_aio_finalize(acb);
>          return;
>      }

This looks semantically correct to me (but I'd like to have an Ack from
Berto), but I would fix it above: We shouldn't do ++acb->child_iter in
the first place if the new value is >= s->num_children. So instead of
decrementing after the fact, just move the increment to inside the then
branch above.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode
  2016-02-04 12:24 ` Kevin Wolf
@ 2016-02-05  1:57   ` Changlong Xie
  0 siblings, 0 replies; 3+ messages in thread
From: Changlong Xie @ 2016-02-05  1:57 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Alberto Garcia, qemu devel, Dr. David Alan Gilbert

On 02/04/2016 08:24 PM, Kevin Wolf wrote:
> Am 04.02.2016 um 11:19 hat Changlong Xie geschrieben:
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
>> ---
>>   block/quorum.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/block/quorum.c b/block/quorum.c
>> index a5ae4b8..0965277 100644
>> --- a/block/quorum.c
>> +++ b/block/quorum.c
>> @@ -295,6 +295,9 @@ static void quorum_aio_cb(void *opaque, int ret)
>>               quorum_copy_qiov(acb->qiov, &acb->qcrs[acb->child_iter].qiov);
>>           }
>>           acb->vote_ret = ret;
>> +        if (ret < 0) {
>> +            acb->child_iter--;
>> +        }
>>           quorum_aio_finalize(acb);
>>           return;
>>       }
>
> This looks semantically correct to me (but I'd like to have an Ack from
> Berto), but I would fix it above: We shouldn't do ++acb->child_iter in
> the first place if the new value is >= s->num_children. So instead of
> decrementing after the fact, just move the increment to inside the then
> branch above.

Yes, will fix in next version.

Thanks
	-Xie
>
> Kevin
>
>
> .
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-05  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-04 10:19 [Qemu-devel] [PATCH] quorum: fix segfault when read fails in fifo mode Changlong Xie
2016-02-04 12:24 ` Kevin Wolf
2016-02-05  1:57   ` Changlong Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).