qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: mreitz@redhat.com, kwolf@redhat.com, den@openvz.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH] nbd/server: introduce NBD_CMD_CACHE
Date: Thu, 17 May 2018 08:34:10 -0500	[thread overview]
Message-ID: <dcffbc2b-e0b0-3c90-0c29-aa0c0be64af8@redhat.com> (raw)
In-Reply-To: <8003bc90-1b11-3d1b-07a3-dca4d49fb79b@virtuozzo.com>

On 05/17/2018 04:52 AM, Vladimir Sementsov-Ogievskiy wrote:
> Finally, what about this?
> 
> 13.04.2018 17:31, Vladimir Sementsov-Ogievskiy wrote:
>> Handle nbd CACHE command. Just do read, without sending read data back.
>> Cache mechanism should be done by exported node driver chain.

Still waiting on the NBD spec review, which I've pinged on the NBD list. 
But as mentioned there, I'll probably go ahead and accept this (possibly 
with slight tweaks) on Monday, after giving one more weekend for any 
last-minute review comments.

>> @@ -1826,7 +1826,9 @@ static int nbd_co_receive_request(NBDRequestData 
>> *req, NBDRequest *request,
>>           return -EIO;
>>       }
>> -    if (request->type == NBD_CMD_READ || request->type == 
>> NBD_CMD_WRITE) {
>> +    if (request->type == NBD_CMD_READ || request->type == 
>> NBD_CMD_WRITE ||
>> +        request->type == NBD_CMD_CACHE)
>> +    {
>>           if (request->len > NBD_MAX_BUFFER_SIZE) {
>>               error_setg(errp, "len (%" PRIu32" ) is larger than max 
>> len (%u)",

I'm not sure I agree with this one. Since we aren't passing the cached 
data over the wire, we can reject the command with EINVAL instead of 
killing the connection entirely.

(As it is, I wonder if we can be nicer about rejecting a read request > 
32M. For a write request, we have to disconnect; but for a read request, 
we can keep the connection alive by just returning EINVAL for a 
too-large read, instead of our current behavior of disconnecting)

>>                          request->len, NBD_MAX_BUFFER_SIZE);
>> @@ -1911,7 +1913,7 @@ static coroutine_fn int 
>> nbd_do_cmd_read(NBDClient *client, NBDRequest *request,
>>       int ret;
>>       NBDExport *exp = client->exp;
>> -    assert(request->type == NBD_CMD_READ);
>> +    assert(request->type == NBD_CMD_READ || request->type == 
>> NBD_CMD_CACHE);
>>       /* XXX: NBD Protocol only documents use of FUA with WRITE */
>>       if (request->flags & NBD_CMD_FLAG_FUA) {
>> @@ -1930,7 +1932,7 @@ static coroutine_fn int 
>> nbd_do_cmd_read(NBDClient *client, NBDRequest *request,
>>       ret = blk_pread(exp->blk, request->from + exp->dev_offset, data,
>>                       request->len);
>> -    if (ret < 0) {
>> +    if (ret < 0 || request->type == NBD_CMD_CACHE) {
>>           return nbd_send_generic_reply(client, request->handle, ret,
>>                                         "reading from file failed", 
>> errp);

As for the implementation on the server side, yes, this looks 
reasonable, given the proposed spec wording being considered on the NBD 
list.

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

  reply	other threads:[~2018-05-17 13:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13 14:31 [Qemu-devel] [PATCH] nbd/server: introduce NBD_CMD_CACHE Vladimir Sementsov-Ogievskiy
2018-04-13 14:43 ` Vladimir Sementsov-Ogievskiy
2018-04-18 16:37 ` Eric Blake
2018-04-19  8:36   ` Vladimir Sementsov-Ogievskiy
2018-04-19 15:59     ` Eric Blake
2018-05-17  9:52 ` Vladimir Sementsov-Ogievskiy
2018-05-17 13:34   ` Eric Blake [this message]
2018-05-29 15:27     ` Vladimir Sementsov-Ogievskiy
2018-06-21 13:13     ` Vladimir Sementsov-Ogievskiy
2018-06-21 14:41 ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcffbc2b-e0b0-3c90-0c29-aa0c0be64af8@redhat.com \
    --to=eblake@redhat.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).