qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] nbd/server: fix NBD_CMD_CACHE
@ 2018-10-03 14:47 Vladimir Sementsov-Ogievskiy
  2018-10-03 14:57 ` Eric Blake
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-10-03 14:47 UTC (permalink / raw)
  To: qemu-devel, qemu-block; +Cc: pbonzini, eblake, vsementsov, den

We should not go to structured-read branch on CACHE command, fix that.

Bug intoroduced in bc37b06a5cde24 "nbd/server: introduce NBD_CMD_CACHE"
with the whole feature and affects 3.0.0 release.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 nbd/server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nbd/server.c b/nbd/server.c
index c3dd402b45..1fba21414b 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -2177,7 +2177,8 @@ static coroutine_fn int nbd_do_cmd_read(NBDClient *client, NBDRequest *request,
     }
 
     if (client->structured_reply && !(request->flags & NBD_CMD_FLAG_DF) &&
-        request->len) {
+        request->len && request->type != NBD_CMD_CACHE)
+    {
         return nbd_co_send_sparse_read(client, request->handle, request->from,
                                        data, request->len, errp);
     }
-- 
2.18.0

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

* Re: [Qemu-devel] [PATCH] nbd/server: fix NBD_CMD_CACHE
  2018-10-03 14:47 [Qemu-devel] [PATCH] nbd/server: fix NBD_CMD_CACHE Vladimir Sementsov-Ogievskiy
@ 2018-10-03 14:57 ` Eric Blake
  2018-10-03 15:10   ` Vladimir Sementsov-Ogievskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2018-10-03 14:57 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy, qemu-devel, qemu-block
  Cc: pbonzini, den, qemu-stable

On 10/3/18 9:47 AM, Vladimir Sementsov-Ogievskiy wrote:
> We should not go to structured-read branch on CACHE command, fix that.
> 
> Bug intoroduced in bc37b06a5cde24 "nbd/server: introduce NBD_CMD_CACHE"

s/intoroduced/introduced/

> with the whole feature and affects 3.0.0 release.

Ouch. It's because I don't have an NBD client that can issue the 
command, so the server side got released without sufficient testing. Is 
there some way we could enhance qemu-io as NBD client to issue such a 
command?

> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

CC: qemu-stable@nongnu.org

Reviewed-by: Eric Blake <eblake@redhat.com>

Will queue through my NBD tree.

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

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

* Re: [Qemu-devel] [PATCH] nbd/server: fix NBD_CMD_CACHE
  2018-10-03 14:57 ` Eric Blake
@ 2018-10-03 15:10   ` Vladimir Sementsov-Ogievskiy
  2018-10-04 13:02     ` [Qemu-devel] [Qemu-block] " Kevin Wolf
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-10-03 15:10 UTC (permalink / raw)
  To: Eric Blake, qemu-devel@nongnu.org, qemu-block@nongnu.org
  Cc: pbonzini@redhat.com, Denis Lunev, qemu-stable

03.10.2018 17:57, Eric Blake wrote:
> On 10/3/18 9:47 AM, Vladimir Sementsov-Ogievskiy wrote:
>> We should not go to structured-read branch on CACHE command, fix that.
>>
>> Bug intoroduced in bc37b06a5cde24 "nbd/server: introduce NBD_CMD_CACHE"
>
> s/intoroduced/introduced/
>
>> with the whole feature and affects 3.0.0 release.
>
> Ouch. It's because I don't have an NBD client that can issue the 
> command, so the server side got released without sufficient testing. 
> Is there some way we could enhance qemu-io as NBD client to issue such 
> a command?

may be, just add qemu-io command, like x-debug-nbd-cmd, which will just 
send any nbd command? and prints all server replies? Then we'll be able 
to write any unit tests on nbd-server. It's not the first time the 
problem arise..

>
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> CC: qemu-stable@nongnu.org
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> Will queue through my NBD tree.
>


-- 
Best regards,
Vladimir


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

* Re: [Qemu-devel] [Qemu-block] [PATCH] nbd/server: fix NBD_CMD_CACHE
  2018-10-03 15:10   ` Vladimir Sementsov-Ogievskiy
@ 2018-10-04 13:02     ` Kevin Wolf
  2018-10-04 14:29       ` Eric Blake
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2018-10-04 13:02 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy
  Cc: Eric Blake, qemu-devel@nongnu.org, qemu-block@nongnu.org,
	pbonzini@redhat.com, Denis Lunev, qemu-stable

Am 03.10.2018 um 17:10 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 03.10.2018 17:57, Eric Blake wrote:
> > On 10/3/18 9:47 AM, Vladimir Sementsov-Ogievskiy wrote:
> >> We should not go to structured-read branch on CACHE command, fix that.
> >>
> >> Bug intoroduced in bc37b06a5cde24 "nbd/server: introduce NBD_CMD_CACHE"
> >
> > s/intoroduced/introduced/
> >
> >> with the whole feature and affects 3.0.0 release.
> >
> > Ouch. It's because I don't have an NBD client that can issue the 
> > command, so the server side got released without sufficient testing. 
> > Is there some way we could enhance qemu-io as NBD client to issue such 
> > a command?
> 
> may be, just add qemu-io command, like x-debug-nbd-cmd, which will just 
> send any nbd command? and prints all server replies? Then we'll be able 
> to write any unit tests on nbd-server. It's not the first time the 
> problem arise..

Shouldn't it be easy to write a simple NBD client in Python and then use
that for test cases? I don't see why this needs to be in qemu-io, and
testing illegal requests is certainly easier with a custom client.

Kevin

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

* Re: [Qemu-devel] [Qemu-block] [PATCH] nbd/server: fix NBD_CMD_CACHE
  2018-10-04 13:02     ` [Qemu-devel] [Qemu-block] " Kevin Wolf
@ 2018-10-04 14:29       ` Eric Blake
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2018-10-04 14:29 UTC (permalink / raw)
  To: Kevin Wolf, Vladimir Sementsov-Ogievskiy
  Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, pbonzini@redhat.com,
	Denis Lunev, qemu-stable

On 10/4/18 8:02 AM, Kevin Wolf wrote:
> Am 03.10.2018 um 17:10 hat Vladimir Sementsov-Ogievskiy geschrieben:
>> 03.10.2018 17:57, Eric Blake wrote:
>>> On 10/3/18 9:47 AM, Vladimir Sementsov-Ogievskiy wrote:
>>>> We should not go to structured-read branch on CACHE command, fix that.
>>>>
>>>> Bug intoroduced in bc37b06a5cde24 "nbd/server: introduce NBD_CMD_CACHE"
>>>
>>> s/intoroduced/introduced/
>>>
>>>> with the whole feature and affects 3.0.0 release.
>>>
>>> Ouch. It's because I don't have an NBD client that can issue the
>>> command, so the server side got released without sufficient testing.
>>> Is there some way we could enhance qemu-io as NBD client to issue such
>>> a command?
>>
>> may be, just add qemu-io command, like x-debug-nbd-cmd, which will just
>> send any nbd command? and prints all server replies? Then we'll be able
>> to write any unit tests on nbd-server. It's not the first time the
>> problem arise..
> 
> Shouldn't it be easy to write a simple NBD client in Python and then use
> that for test cases? I don't see why this needs to be in qemu-io, and
> testing illegal requests is certainly easier with a custom client.

Indeed, and we already have tests/qemu-iotests/nbd-fault-injector.py 
which implements a custom server (unfortunately, it has not been updated 
to use newstyle yet!), as a reference for implementing a similar custom 
client.

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

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

end of thread, other threads:[~2018-10-04 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-03 14:47 [Qemu-devel] [PATCH] nbd/server: fix NBD_CMD_CACHE Vladimir Sementsov-Ogievskiy
2018-10-03 14:57 ` Eric Blake
2018-10-03 15:10   ` Vladimir Sementsov-Ogievskiy
2018-10-04 13:02     ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2018-10-04 14:29       ` Eric Blake

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