qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nbd: Fix regression with multiple meta contexts
@ 2020-02-06 17:38 Eric Blake
  2020-02-06 17:54 ` Laurent Vivier
  2020-02-12  9:24 ` Laurent Vivier
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Blake @ 2020-02-06 17:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, pannengyuan, laurent, qemu-block

Detected by a hang in the libnbd testsuite.  If a client requests
multiple meta contexts (both base:allocation and qemu:dirty-bitmap:x)
at the same time, our attempt to silence a false-positive warning
about a potential uninitialized variable introduced botched logic: we
were short-circuiting the second context, and never sending the
NBD_REPLY_FLAG_DONE.  Combining two 'if' into one 'if/else' in
bdf200a55 was wrong (I'm a bit embarrassed that such a change was my
initial suggestion after the v1 patch, then I did not review the v2
patch that actually got committed). Revert that, and instead silence
the false positive warning by replacing 'return ret' with 'return 0'
(the value it always has at that point in the code, even though it
eluded the deduction abilities of the robot that reported the false
positive).

Fixes: bdf200a5535
Signed-off-by: Eric Blake <eblake@redhat.com>
---

It's never fun when a regression is caused by a patch taken through
qemu-trivial, proving that the patch was not trivial after all.

 nbd/server.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/nbd/server.c b/nbd/server.c
index 87fcd2e7bfac..11a31094ff83 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -2384,15 +2384,23 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
                                                !client->export_meta.bitmap,
                                                NBD_META_ID_BASE_ALLOCATION,
                                                errp);
-            } else {              /* client->export_meta.bitmap */
+                if (ret < 0) {
+                    return ret;
+                }
+            }
+
+            if (client->export_meta.bitmap) {
                 ret = nbd_co_send_bitmap(client, request->handle,
                                          client->exp->export_bitmap,
                                          request->from, request->len,
                                          dont_fragment,
                                          true, NBD_META_ID_DIRTY_BITMAP, errp);
+                if (ret < 0) {
+                    return ret;
+                }
             }

-            return ret;
+            return 0;
         } else {
             return nbd_send_generic_reply(client, request->handle, -EINVAL,
                                           "CMD_BLOCK_STATUS not negotiated",
-- 
2.24.1



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

* Re: [PATCH] nbd: Fix regression with multiple meta contexts
  2020-02-06 17:38 [PATCH] nbd: Fix regression with multiple meta contexts Eric Blake
@ 2020-02-06 17:54 ` Laurent Vivier
  2020-02-12  9:24 ` Laurent Vivier
  1 sibling, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2020-02-06 17:54 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-trivial, pannengyuan, qemu-block

Le 06/02/2020 à 18:38, Eric Blake a écrit :
> Detected by a hang in the libnbd testsuite.  If a client requests
> multiple meta contexts (both base:allocation and qemu:dirty-bitmap:x)
> at the same time, our attempt to silence a false-positive warning
> about a potential uninitialized variable introduced botched logic: we
> were short-circuiting the second context, and never sending the
> NBD_REPLY_FLAG_DONE.  Combining two 'if' into one 'if/else' in
> bdf200a55 was wrong (I'm a bit embarrassed that such a change was my
> initial suggestion after the v1 patch, then I did not review the v2
> patch that actually got committed). Revert that, and instead silence
> the false positive warning by replacing 'return ret' with 'return 0'
> (the value it always has at that point in the code, even though it
> eluded the deduction abilities of the robot that reported the false
> positive).
> 
> Fixes: bdf200a5535
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> 
> It's never fun when a regression is caused by a patch taken through
> qemu-trivial, proving that the patch was not trivial after all.

trivial doesn't mean not reviewed...
The patch v1 was trivial, the v2 wasn't.

> 
>  nbd/server.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/nbd/server.c b/nbd/server.c
> index 87fcd2e7bfac..11a31094ff83 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -2384,15 +2384,23 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
>                                                 !client->export_meta.bitmap,
>                                                 NBD_META_ID_BASE_ALLOCATION,
>                                                 errp);
> -            } else {              /* client->export_meta.bitmap */
> +                if (ret < 0) {
> +                    return ret;
> +                }
> +            }
> +
> +            if (client->export_meta.bitmap) {
>                  ret = nbd_co_send_bitmap(client, request->handle,
>                                           client->exp->export_bitmap,
>                                           request->from, request->len,
>                                           dont_fragment,
>                                           true, NBD_META_ID_DIRTY_BITMAP, errp);
> +                if (ret < 0) {
> +                    return ret;
> +                }
>              }
> 
> -            return ret;
> +            return 0;
>          } else {
>              return nbd_send_generic_reply(client, request->handle, -EINVAL,
>                                            "CMD_BLOCK_STATUS not negotiated",
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


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

* Re: [PATCH] nbd: Fix regression with multiple meta contexts
  2020-02-06 17:38 [PATCH] nbd: Fix regression with multiple meta contexts Eric Blake
  2020-02-06 17:54 ` Laurent Vivier
@ 2020-02-12  9:24 ` Laurent Vivier
  2020-02-12 12:10   ` Eric Blake
  1 sibling, 1 reply; 5+ messages in thread
From: Laurent Vivier @ 2020-02-12  9:24 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-trivial, pannengyuan, qemu-block

Le 06/02/2020 à 18:38, Eric Blake a écrit :
> Detected by a hang in the libnbd testsuite.  If a client requests
> multiple meta contexts (both base:allocation and qemu:dirty-bitmap:x)
> at the same time, our attempt to silence a false-positive warning
> about a potential uninitialized variable introduced botched logic: we
> were short-circuiting the second context, and never sending the
> NBD_REPLY_FLAG_DONE.  Combining two 'if' into one 'if/else' in
> bdf200a55 was wrong (I'm a bit embarrassed that such a change was my
> initial suggestion after the v1 patch, then I did not review the v2
> patch that actually got committed). Revert that, and instead silence
> the false positive warning by replacing 'return ret' with 'return 0'
> (the value it always has at that point in the code, even though it
> eluded the deduction abilities of the robot that reported the false
> positive).
> 
> Fixes: bdf200a5535
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> 
> It's never fun when a regression is caused by a patch taken through
> qemu-trivial, proving that the patch was not trivial after all.

Do you want this one be merged using the trivial branch?

Thanks,
Laurent



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

* Re: [PATCH] nbd: Fix regression with multiple meta contexts
  2020-02-12  9:24 ` Laurent Vivier
@ 2020-02-12 12:10   ` Eric Blake
  2020-02-12 12:13     ` Laurent Vivier
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2020-02-12 12:10 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: qemu-trivial, pannengyuan, qemu-block

On 2/12/20 3:24 AM, Laurent Vivier wrote:
> Le 06/02/2020 à 18:38, Eric Blake a écrit :
>> Detected by a hang in the libnbd testsuite.  If a client requests
>> multiple meta contexts (both base:allocation and qemu:dirty-bitmap:x)
>> at the same time, our attempt to silence a false-positive warning
>> about a potential uninitialized variable introduced botched logic: we
>> were short-circuiting the second context, and never sending the
>> NBD_REPLY_FLAG_DONE.  Combining two 'if' into one 'if/else' in
>> bdf200a55 was wrong (I'm a bit embarrassed that such a change was my
>> initial suggestion after the v1 patch, then I did not review the v2
>> patch that actually got committed). Revert that, and instead silence
>> the false positive warning by replacing 'return ret' with 'return 0'
>> (the value it always has at that point in the code, even though it
>> eluded the deduction abilities of the robot that reported the false
>> positive).
>>
>> Fixes: bdf200a5535
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>> ---
>>
>> It's never fun when a regression is caused by a patch taken through
>> qemu-trivial, proving that the patch was not trivial after all.
> 
> Do you want this one be merged using the trivial branch?

Up to you; I'm also fine taking it through my NBD tree as I have a few 
other NBD patches landing soon.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



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

* Re: [PATCH] nbd: Fix regression with multiple meta contexts
  2020-02-12 12:10   ` Eric Blake
@ 2020-02-12 12:13     ` Laurent Vivier
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2020-02-12 12:13 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-trivial, pannengyuan, qemu-block

Le 12/02/2020 à 13:10, Eric Blake a écrit :
> On 2/12/20 3:24 AM, Laurent Vivier wrote:
>> Le 06/02/2020 à 18:38, Eric Blake a écrit :
>>> Detected by a hang in the libnbd testsuite.  If a client requests
>>> multiple meta contexts (both base:allocation and qemu:dirty-bitmap:x)
>>> at the same time, our attempt to silence a false-positive warning
>>> about a potential uninitialized variable introduced botched logic: we
>>> were short-circuiting the second context, and never sending the
>>> NBD_REPLY_FLAG_DONE.  Combining two 'if' into one 'if/else' in
>>> bdf200a55 was wrong (I'm a bit embarrassed that such a change was my
>>> initial suggestion after the v1 patch, then I did not review the v2
>>> patch that actually got committed). Revert that, and instead silence
>>> the false positive warning by replacing 'return ret' with 'return 0'
>>> (the value it always has at that point in the code, even though it
>>> eluded the deduction abilities of the robot that reported the false
>>> positive).
>>>
>>> Fixes: bdf200a5535
>>> Signed-off-by: Eric Blake <eblake@redhat.com>
>>> ---
>>>
>>> It's never fun when a regression is caused by a patch taken through
>>> qemu-trivial, proving that the patch was not trivial after all.
>>
>> Do you want this one be merged using the trivial branch?
> 
> Up to you; I'm also fine taking it through my NBD tree as I have a few
> other NBD patches landing soon.
> 

For the moment, I have only one patch in my queue so I think you can
take it.

Thanks,
Laurent


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

end of thread, other threads:[~2020-02-12 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 17:38 [PATCH] nbd: Fix regression with multiple meta contexts Eric Blake
2020-02-06 17:54 ` Laurent Vivier
2020-02-12  9:24 ` Laurent Vivier
2020-02-12 12:10   ` Eric Blake
2020-02-12 12:13     ` Laurent Vivier

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).