[Nbd] [PATCH v2 1/2] nbd: add support for feature negotiation

2011-09-08 Thread Paolo Bonzini
the flags when NBD_DO_IT completes. Cc: Paul Clements paul.cleme...@steeleye.com Cc: nbd-gene...@lists.sf.net Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- drivers/block/nbd.c | 10 +- include/linux/nbd.h | 28 ++-- 2 files changed, 23 insertions(+), 15

[Nbd] [PATCH] add support for NBD_CMD_TRIM, update docs

2011-09-08 Thread Paolo Bonzini
Update the protocol documentation, and implement it as a dummy command in the server. --- This part should be quite uncontroversial, and so should be patch 2/2 in my kernel series. However, patch 1 is basically doing the same as the patch from Alex Bligh that

Re: [Nbd] fua, trim, etc

2011-09-13 Thread Paolo Bonzini
On 09/13/2011 09:54 AM, Alex Bligh wrote: Paolo, --On 13 September 2011 09:49:01 +0200 Paolo Bonzini pbonz...@redhat.com wrote: On 09/13/2011 09:47 AM, Folkert van Heusden wrote: It might be a good way to get a flags-passing mechanism acceptable to Paul et al ready. Will that change

Re: [Nbd] TRIM stuff

2011-09-20 Thread Paolo Bonzini
On 09/16/2011 12:17 PM, Alex Bligh wrote: Scratch that, make that need to have error handling, period. If PUNCH_HOLE fails, can't you just translate it to a write of zeros over the area, and use the normal error handling for that? If we can't TRIM (which might be for reasons quite

Re: [Nbd] maximum size of a read/write request

2011-10-10 Thread Paolo Bonzini
On 10/06/2011 12:53 PM, Folkert van Heusden wrote: Hi, What is the maximum size of a read/write request? E.g. how much data can be requested/transmitted using one read or write command? And can this be limited using a nbd-client command-line setting and/or nbd protocol handshake? In

Re: [Nbd] [CFT][PATCH 0/4] nbd-module: merge of FLUSH/FUA and DISCARD series

2011-10-25 Thread Paolo Bonzini
On 09/13/2011 02:28 PM, Alex Bligh wrote: --On 13 September 2011 14:05:41 +0200 Paolo Bonzinipbonzini-h+wxahxf7alqt0dzr+a...@public.gmane.org wrote: I see you've got support for NBD_TIMEOUT in your patch set too. That might be better broken out. It's just ioctl_cmd_to_ascii. doh.

Re: [Nbd] [CFT][PATCH 0/4] nbd-module: merge of FLUSH/FUA and DISCARD series

2011-10-26 Thread Paolo Bonzini
On 10/26/2011 12:32 AM, Alex Bligh wrote: OK - I think my tree is based on 2.6.32, so I may have a little work to do. Ping? I haven't had time to look at this, but thanks for the reminder. I will. The reminder was more for Paul than for you... Paolo

Re: [Nbd] [PATCH 1/3] nbd: support FLUSH requests

2013-02-13 Thread Paolo Bonzini
much unusable, unlike discard failures. Signed-off-by: Alex Bligh a...@alex.org.uk Signed-off-by: Paolo Bonzini pbonz...@redhat.com Cc: Paul Clements paul.cleme...@steeleye.com Signed-off-by: Andrew Morton a...@linux-foundation.org --- Paolo

Re: [Nbd] [PATCH 2/3] nbd: fsync and kill block device on shutdown

2013-02-13 Thread Paolo Bonzini
Il 12/02/2013 22:41, Andrew Morton ha scritto: There are two problems with shutdown in the NBD driver. The first is that receiving the NBD_DISCONNECT ioctl does not sync the filesystem; this is useful because BLKFLSBUF is restricted to processes that have CAP_SYS_ADMIN, and the NBD client

Re: [Nbd] [PATCH 1/3] nbd: support FLUSH requests

2013-02-13 Thread Paolo Bonzini
Il 13/02/2013 16:55, Alex Bligh ha scritto: But as far as I can test with free servers, the FUA bits have no advantage over flush. Also, I wasn't sure if SEND_FUA without SEND_FLUSH is valid, and if so how to handle this combination (treat it as writethrough and add FUA to all requests?

Re: [Nbd] NBD TLS support in QEMU

2014-10-02 Thread Paolo Bonzini
Il 01/10/2014 22:23, Wouter Verhelst ha scritto: Hi, On Fri, Sep 05, 2014 at 03:26:09PM +0200, Wouter Verhelst wrote: Tunneling the entire protocol inside an SSL connection doesn't fix that; if an attacker is able to hijack your TCP connections and change flags, then this attacker is also

Re: [Nbd] NBD TLS support in QEMU

2014-10-02 Thread Paolo Bonzini
Il 02/10/2014 13:05, Daniel P. Berrange ha scritto: On Wed, Oct 01, 2014 at 10:23:26PM +0200, Wouter Verhelst wrote: Hi, On Fri, Sep 05, 2014 at 03:26:09PM +0200, Wouter Verhelst wrote: Tunneling the entire protocol inside an SSL connection doesn't fix that; if an attacker is able to hijack

Re: [Nbd] NBD TLS support in QEMU

2014-10-09 Thread Paolo Bonzini
Il 08/10/2014 20:16, Wouter Verhelst ha scritto: @@ -242,10 +242,13 @@ Option types * NBD_OPT_EXPORT_NAME (1) Choose the export which the client would like to use, and end option haggling. Data: name of the export, free-form UTF8 text (subject to limitations by server

Re: [Nbd] [PATCH] docs/proto: clarify NBD_CMD_FLUSH

2015-05-14 Thread Paolo Bonzini
On 14/05/2015 12:33, Wouter Verhelst wrote: On Fri, May 08, 2015 at 12:16:16PM +0200, Paolo Bonzini wrote: There are two problems: 1) A literal reading of the specification could imply that the server could not send a reply if fsync() fails, because in that case previous writes have

Re: [Nbd] [PATCH] define error values as part of the protocol

2015-05-14 Thread Paolo Bonzini
On 14/05/2015 13:02, Wouter Verhelst wrote: I don't think so. Let the client worry about it. They can always decide to disconnect if they get ENOMEM, or they can get into a recovery mode with some kind of exponential backoff, or... Yeah, but then that's not what I meant with fatal. I

Re: [Nbd] (QEmu-)NBD and discard/TRIM

2016-01-07 Thread Paolo Bonzini
On 31/12/2015 12:30, Sitsofe Wheeler wrote: > Further, re-running qemu-nbd with -v says this: > nbd.c:nbd_co_receive_request():L1232: len (536870912) is larger than max len > (33554432) > which comes from https://github.com/qemu/qemu/blob/v2.5.0/nbd.c#L1230 : > if (request->len >

Re: [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands

2016-06-14 Thread Paolo Bonzini
On 13/06/2016 23:41, Alex Bligh wrote: > That's one of the reasons that there is a proposal to add > STRUCTURED_READ to the spec (although I still haven't had time to > implement that for qemu), so that we have a newer approach that allows > for proper error handling without ambiguity on whether

Re: [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands

2016-06-14 Thread Paolo Bonzini
On 14/06/2016 17:02, Alex Bligh wrote: > > On 14 Jun 2016, at 14:32, Paolo Bonzini <pbonz...@redhat.com> wrote: > >> >> On 13/06/2016 23:41, Alex Bligh wrote: >>> That's one of the reasons that there is a proposal to add >>> STRUCTURED_READ t

Re: [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands

2016-06-15 Thread Paolo Bonzini
- Original Message - > From: "Alex Bligh" <a...@alex.org.uk> > To: "Wouter Verhelst" <w...@uter.be> > Cc: "Alex Bligh" <a...@alex.org.uk>, nbd-general@lists.sourceforge.net, > "Paolo Bonzini" <pbonz...@redhat.c

Re: [Nbd] [PATCH v4 04/11] nbd: Improve server handling of bogus commands

2016-06-14 Thread Paolo Bonzini
On 14/06/2016 17:59, Alex Bligh wrote: > >> On 14 Jun 2016, at 16:11, Paolo Bonzini <pbonz...@redhat.com> wrote: >> >>> To illustrate the problem, look consider what qemu itself would do as >>> a server if it can't buffer the entire read issued to it.

Re: [Nbd] [Qemu-devel] Is NBD_CMD_FLAG_FUA valid during NBD_CMD_FLUSH?

2016-04-05 Thread Paolo Bonzini
On 05/04/2016 07:09, Kevin Wolf wrote: > > TRIM is an advisory operation, so it doesn't make sense to force access > > to the medium. > > I think it does make sense. It means that on completion there is no > pending discard operation (i.e. either there wasn't a discard or if > there was, it has

Re: [Nbd] [PATCH v2] doc: Add NBD_CMD_BLOCK_STATUS extension

2016-04-05 Thread Paolo Bonzini
On 04/04/2016 22:03, Alex Bligh wrote: > So qemu-nbdserver has some idea of 'dirtiness', and you want > to publish that, and the consumer is qemu (and only qemu), > because only qemu knows what 'dirtiness' means in the > sense the server provides it? The consumer is not QEMU; the consumer is

Re: [Nbd] [PATCHv3] Improve the documentation of NBD_CMD_FLUSH and NBD_CMD_FLAG_FUA.

2016-04-05 Thread Paolo Bonzini
On 05/04/2016 14:07, Alex Bligh wrote: > Improve the documentation of NBD_CMD_FLUSH and NBD_CMD_FLAG_FUA. Specifically > the latter may be set on any command, and its semantics on commands other > than NBD_CMD_WRITE need explaining. Further, explain how these relate to > reordering of commands.

Re: [Nbd] [PATCHv3] Improve the documentation of NBD_CMD_FLUSH and NBD_CMD_FLAG_FUA.

2016-04-05 Thread Paolo Bonzini
On 05/04/2016 17:16, Alex Bligh wrote: > > > * Document that sending FUA for commands that do nothing is permissible, > > > but > > > 'SHOULD NOT' be done; an existing client does this. > > > > Can you send a pointer to the discussion? FUA on reads definitely does > > *something* in SCSI (it

Re: [Nbd] [PATCH v2] doc: Add NBD_CMD_BLOCK_STATUS extension

2016-04-07 Thread Paolo Bonzini
On 07/04/2016 17:35, Pavel Borzenkov wrote: > > On 05/04/2016 06:05, Kevin Wolf wrote: > > > The options I can think of is adding a request field "max number of > > > descriptors" or a flag "only single descriptor" (with the assumption > > > that clients always want one or unlimited), but maybe

Re: [Nbd] [PATCH] doc: Allow NBD_CMD_FLAG_NO_HOLE during NBD_CMD_WRITE

2016-04-05 Thread Paolo Bonzini
On 04/04/2016 16:15, Eric Blake wrote: > qemu already has an existing server implementation option that will > explicitly search the payload of NBD_CMD_WRITE for large blocks of > zeroes, and punch holes in the underlying file. For old clients > that don't know how to use the new

Re: [Nbd] [PATCH 1/2] NBD proto: add WRITE_ZEROES extension

2016-03-24 Thread Paolo Bonzini
On 24/03/2016 09:26, Wouter Verhelst wrote: >> > >> > No, there is no specific reason. Looks like NBD_CMD_FLAG_ZEROES fits the >> > spec and implementations nicely. So I'll rewrite the extension and add >> > the flag instead of the whole command. > Actually, having given this some more

Re: [Nbd] [PATCH 2/2] NBD proto: add GET_LBA_STATUS extension

2016-03-24 Thread Paolo Bonzini
On 24/03/2016 11:32, Alex Bligh wrote: >> > Now I'm not saying we >> > need to fully define what it means for a part of the backend to be >> > "dirty" or not. It's okay to leave part of the meaning in the dark, >> > leaving that implementation-defined. > Well, the 3 possible states are: > > *

Re: [Nbd] [PATCH 2/2] NBD proto: add GET_LBA_STATUS extension

2016-03-24 Thread Paolo Bonzini
On 23/03/2016 18:58, Wouter Verhelst wrote: >> +To provide such class of information, `GET_LBA_STATUS` extension adds new >> +`NBD_CMD_GET_LBA_STATUS` command which returns a list of LBA ranges with >> +their respective states. >> + >> +* `NBD_CMD_GET_LBA_STATUS` (7) >> + >> +An LBA range

Re: [Nbd] [PATCH 2/2] NBD proto: add GET_LBA_STATUS extension

2016-03-24 Thread Paolo Bonzini
On 24/03/2016 14:31, Alex Bligh wrote: > Sorry, I should have been clearer on the states: > > bits > 210 > > 1-- Unallocated, and hence reads as zero > -1- Allocated, and reads as zero > --1 Allocated, and reads as non-zero > > So 100 means 'definitely unallocated, will read as zero'. > > If

Re: [Nbd] [Qemu-devel] [PATCH 2/2] NBD proto: add GET_LBA_STATUS extension

2016-03-24 Thread Paolo Bonzini
On 24/03/2016 16:25, Eric Blake wrote: >> However, let's make these bits, so that >> >> NBD_STATE_ALLOCATED (0x1), LBA extent is present on the block device >> NBD_STATE_ZERO (0x2), LBA extent will read as zeroes > > Should we flip the sense and call this NBD_STATE_UNALLOCATED (0 means >

Re: [Nbd] [PATCH 2/2] NBD proto: add GET_LBA_STATUS extension

2016-03-24 Thread Paolo Bonzini
On 24/03/2016 13:17, Alex Bligh wrote: >>> >> * unallocated >>> >> * zero >>> >> * non-zero >>> >> >>> >> So the possible replies are a bitfield of those, with a '1' if it 'might' >>> >> be in that state, i.e. >>> >> >>> >> 111 = no idea >>> >> 110 = might be zero or unallocated, but isn't

Re: [Nbd] [RFC 1/1] nbd (specification): add NBD_CMD_WRITE_ZEROES command

2016-03-04 Thread Paolo Bonzini
On 04/03/2016 10:54, Kevin Wolf wrote: >>> - pls write the following amount of zeroes in either way (even calling >>> > >write directly), i.e. ensure that the data is zeroed and the space on >>> > >the file system is allocated for that. >> > >> > IOW, you *don't* want to have a sparse

Re: [Nbd] [PATCH v2 1/1] NBD proto: add WRITE_ZEROES extension

2016-03-31 Thread Paolo Bonzini
On 31/03/2016 16:27, Alex Bligh wrote: > > > IE why not always permit trimming PROVIDED the data always reads back > > > as zero? This would be far simpler. > > > > Because trimming can make future operations more expensive and cause > > fragmentation (which may not be as bad as it used to be

Re: [Nbd] Is NBD_CMD_FLAG_FUA valid during NBD_CMD_FLUSH?

2016-04-01 Thread Paolo Bonzini
On 31/03/2016 22:17, Alex Bligh wrote: >> > In qemu, read+FUA just triggers blk_co_flush() prior to reading; but >> > that's the same function it calls for write+FUA. > That's harmless, but unnecessary in the sense that current documented > behaviour doesn't require it. Perhaps it should? > > I

Re: [Nbd] Is NBD_CMD_FLAG_FUA valid during NBD_CMD_FLUSH?

2016-04-01 Thread Paolo Bonzini
On 31/03/2016 22:34, Eric Blake wrote: > give me possibly stale data because I accessed > the underlying storage rather than paying attention to in-flight writes > that would change what I read". Overlapping I/O is always unspecified, so you should expect stale data if a read overlaps an

Re: [Nbd] [Qemu-devel] [PATCH] nbd: fix trim/discard commands with a length bigger than NBD_MAX_BUFFER_SIZE

2016-05-11 Thread Paolo Bonzini
On 10/05/2016 18:23, Alex Bligh wrote: > > Is there a use case where you'd want to split up a single big TRIM request > > in smaller ones (as in some hardware would not support it or something)? > > Even then, it looks like this splitting up would be hardware dependant and > > better implemented

Re: [Nbd] [Qemu-devel] [PATCH] nbd: fix trim/discard commands with a length bigger than NBD_MAX_BUFFER_SIZE

2016-05-11 Thread Paolo Bonzini
On 11/05/2016 16:55, Alex Bligh wrote: >> > Then I think I will propose a doc patch to the extension-info branch >> > that adds new INFO items for NBD_INFO_TRIM_SIZE and >> > NBD_INFO_WRITE_ZERO_SIZE (if requested by client and replied by server, >> > then this can be larger than the normal

Re: [Nbd] [Qemu-devel] [PATCH] nbd: fix trim/discard commands with a length bigger than NBD_MAX_BUFFER_SIZE

2016-05-10 Thread Paolo Bonzini
On 10/05/2016 17:38, Alex Bligh wrote: > > and are at the > > mercy of however the kernel currently decides to split large requests). > > I am surprised TRIM doesn't get broken up the same way READ and WRITE > do. The payload of TRIM has constant size, so it makes sense to do that. The kernel

Re: [Nbd] [PATCH] NBD: replace kill_bdev() with __invalidate_device()

2016-05-10 Thread Paolo Bonzini
On 23/04/2016 04:17, Ratna Manoj wrote: > Ext4 can be fixed with the this patch: > http://www.spinics.net/lists/linux-ext4/msg51112.html > It did not make to the kernel. It checks the state of the buffer head > before committing. The patch did not make it, but Ted Ts'o proposed an alternative

Re: [Nbd] [Qemu-devel] [PATCH v5 13/14] nbd: Implement NBD_CMD_WRITE_ZEROES on server

2016-07-19 Thread Paolo Bonzini
On 19/07/2016 17:28, Eric Blake wrote: >> If I'm reading the NBD proto.md correctly, this is not enough if >> NBD_CMD_FLAG_NO_HOLE is specified. We probably need to use a zeroed buffer >> with >> blk_pwrite, or pass a new flag (BDRV_RED_NO_HOLE) to blk_pwrite_zeroes to >> enforce the

Re: [Nbd] [Qemu-devel] [PATCH v5 13/14] nbd: Implement NBD_CMD_WRITE_ZEROES on server

2016-07-20 Thread Paolo Bonzini
On 20/07/2016 06:37, Fam Zheng wrote: > Yes, you are right about this, I was confused because "qemu-img map" does not > report this allocation state after zero write. (No idea why SEEK_DATA doesn't > hit the fallocate'ed area.) Apparently it's because it's zeroed. $ fallocate -z -o 10485760 -l

Re: [Nbd] [RESEND][PATCH 0/5] nbd improvements

2016-09-15 Thread Paolo Bonzini
e (if there is no coordination between the different > connections, on an image where the writer changes AA to BA then flushes > then changes to BB, it is still feasible that a reader could see AB > (pre-flush state of the first sector, post-flush changes to the second > sector, even thou

Re: [Nbd] [RESEND][PATCH 0/5] nbd improvements

2016-09-15 Thread Paolo Bonzini
On 15/09/2016 17:23, Alex Bligh wrote: > Paolo, > >> On 15 Sep 2016, at 15:07, Paolo Bonzini <pbonz...@redhat.com> wrote: >> >> I don't think QEMU forbids multiple clients to the single server, and >> guarantees consistency as long as there is no

Re: [Nbd] [PATCH] proto: add 'shift' extension.

2016-09-27 Thread Paolo Bonzini
- Original Message - > From: "Denis V. Lunev" <d...@virtuozzo.com> > To: "Paolo Bonzini" <pbonz...@redhat.com> > Cc: "Vladimir Sementsov-Ogievskiy" <vsement...@virtuozzo.com>, > qemu-de...@nongnu.org, qemu-bl...@nongnu.org

Re: [Nbd] [PATCH] proto: add 'shift' extension.

2016-09-27 Thread Paolo Bonzini
On 27/09/2016 15:28, Denis V. Lunev wrote: > On 09/27/2016 03:07 PM, Paolo Bonzini wrote: >> >> - Original Message - >>> From: "Denis V. Lunev" <d...@virtuozzo.com> >>> To: "Paolo Bonzini" <pbonz...@redhat.com> >>>

Re: [Nbd] write_zeroes/trim on the whole disk

2016-09-26 Thread Paolo Bonzini
On 24/09/2016 14:27, Vladimir Sementsov-Ogievskiy wrote: > On 24.09.2016 15:06, Vladimir Sementsov-Ogievskiy wrote: >> On 24.09.2016 00:21, Wouter Verhelst wrote: >>> On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: My preference would be a new flag to the existing commands, with

Re: [Nbd] [PATCH] proto: add 'shift' extension.

2016-09-26 Thread Paolo Bonzini
On 26/09/2016 14:46, Vladimir Sementsov-Ogievskiy wrote: > This extension allows big requests for TRIM and WRITE_ZEROES through > special 'shift' parameter, which means that offset and length should be > shifted left by several bits. > > This is needed for efficient clearing large regions of

Re: [Nbd] [PATCH] proto: add 'shift' extension.

2016-09-26 Thread Paolo Bonzini
On 26/09/2016 15:53, Vladimir Sementsov-Ogievskiy wrote: > On 26.09.2016 15:51, Paolo Bonzini wrote: >> This is very ad hoc. Can we instead have a block size common to all >> commands? Block devices in practice have one, in fact that's why >> they're called block devices..