qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode
@ 2016-02-05  2:25 Changlong Xie
  2016-02-05 13:28 ` Alberto Garcia
  2016-02-05 15:46 ` Eric Blake
  0 siblings, 2 replies; 5+ messages in thread
From: Changlong Xie @ 2016-02-05  2:25 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, 2 insertions(+), 1 deletion(-)

diff --git a/block/quorum.c b/block/quorum.c
index a5ae4b8..11cc60b 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -286,7 +286,8 @@ static void quorum_aio_cb(void *opaque, int ret)
 
     if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) {
         /* We try to read next child in FIFO order if we fail to read */
-        if (ret < 0 && ++acb->child_iter < s->num_children) {
+        if (ret < 0 && (acb->child_iter + 1) < s->num_children) {
+            acb->child_iter++;
             read_fifo_child(acb);
             return;
         }
-- 
1.9.3

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

* Re: [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode
  2016-02-05  2:25 [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode Changlong Xie
@ 2016-02-05 13:28 ` Alberto Garcia
  2016-02-05 15:47   ` Kevin Wolf
  2016-02-05 15:46 ` Eric Blake
  1 sibling, 1 reply; 5+ messages in thread
From: Alberto Garcia @ 2016-02-05 13:28 UTC (permalink / raw)
  To: Changlong Xie, qemu devel, Kevin Wolf, Eric Blake; +Cc: Dr. David Alan Gilbert

On Fri 05 Feb 2016 03:25:22 AM CET, Changlong Xie <xiecl.fnst@cn.fujitsu.com> wrote:
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto

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

* Re: [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode
  2016-02-05  2:25 [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode Changlong Xie
  2016-02-05 13:28 ` Alberto Garcia
@ 2016-02-05 15:46 ` Eric Blake
  2016-02-15  5:08   ` Changlong Xie
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Blake @ 2016-02-05 15:46 UTC (permalink / raw)
  To: Changlong Xie, qemu devel, Alberto Garcia, Kevin Wolf
  Cc: Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

On 02/04/2016 07:25 PM, Changlong Xie wrote:
> 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, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/quorum.c b/block/quorum.c
> index a5ae4b8..11cc60b 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -286,7 +286,8 @@ static void quorum_aio_cb(void *opaque, int ret)
>  
>      if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) {
>          /* We try to read next child in FIFO order if we fail to read */
> -        if (ret < 0 && ++acb->child_iter < s->num_children) {
> +        if (ret < 0 && (acb->child_iter + 1) < s->num_children) {

Could shorten this as
  if (ret < 0 && acb->child_iter <= s->num_children) {
but I'm not sure it's worth the mental gymnastics.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

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

Am 05.02.2016 um 14:28 hat Alberto Garcia geschrieben:
> On Fri 05 Feb 2016 03:25:22 AM CET, Changlong Xie <xiecl.fnst@cn.fujitsu.com> wrote:
> > Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> > Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> 
> Reviewed-by: Alberto Garcia <berto@igalia.com>

Thanks, applied to the block branch.

Kevin

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

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

On 02/05/2016 11:46 PM, Eric Blake wrote:
> On 02/04/2016 07:25 PM, Changlong Xie wrote:
>> 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, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/quorum.c b/block/quorum.c
>> index a5ae4b8..11cc60b 100644
>> --- a/block/quorum.c
>> +++ b/block/quorum.c
>> @@ -286,7 +286,8 @@ static void quorum_aio_cb(void *opaque, int ret)
>>
>>       if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) {
>>           /* We try to read next child in FIFO order if we fail to read */
>> -        if (ret < 0 && ++acb->child_iter < s->num_children) {
>> +        if (ret < 0 && (acb->child_iter + 1) < s->num_children) {
>
> Could shorten this as
>    if (ret < 0 && acb->child_iter <= s->num_children) {
> but I'm not sure it's worth the mental gymnastics.

Hi Eric

Just the same to me. Since it has been applied to block branch. Let's 
keep the original one.

Thanks
	-Xie
>

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

end of thread, other threads:[~2016-02-15  5:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05  2:25 [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode Changlong Xie
2016-02-05 13:28 ` Alberto Garcia
2016-02-05 15:47   ` Kevin Wolf
2016-02-05 15:46 ` Eric Blake
2016-02-15  5:08   ` 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).