Statistics
| Branch: | Revision:

root / block / nbd.c @ 8bf9344a

History | View | Annotate | Download (19 kB)

# Date Author Comment
23307908 06/18/2013 12:43 pm Ján Tomko

nbd: strip braces from literal IPv6 address in URI

Otherwise they would get passed to getaddrinfo and fail with:
address resolution failed for [::1]:1234: Name or service not known

(Broken by commit v1.4.0-736-gf17c90b)

Signed-off-by: Ján Tomko <>...

c7e775e4 05/12/2013 12:25 pm Dong Xu Wang

remove double semicolons

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Michael Tokarev <>

f1ab7a5a 04/22/2013 04:08 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

  1. By Kevin Wolf (16) and Stefan Hajnoczi (4)
  2. Via Kevin Wolf
    • kwolf/for-anthony:
      qemu-iotests: add 053 unaligned compressed image size test
      block: Allow overriding backing.file.filename
      block: Remove filename parameter from .bdrv_file_open()...
56d1b4d2 04/22/2013 12:34 pm Kevin Wolf

block: Remove filename parameter from .bdrv_file_open()

It is unused now in all block drivers.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

97ebbab0 04/15/2013 05:35 pm Stefan Hajnoczi

nbd: set TCP_NODELAY

Disable the Nagle algorithm to reduce latency. Note this means we must
also use TCP_CORK when sending header followed by payload to avoid
fragmenting lots of little packets. The previous patch took care of
that.

Suggested-by: Nick Thomas <>...

0fcece25 04/15/2013 05:30 pm Stefan Hajnoczi

nbd: use TCP_CORK in nbd_co_send_request()

Use TCP_CORK to defer packet transmission until both the header and the
payload have been written.

Suggested-by: Nick Thomas <>
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Paolo Bonzini <>

6760c47a 04/15/2013 05:29 pm Stefan Hajnoczi

nbd: unlock mutex in nbd_co_send_request() error path

Cc:
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Paolo Bonzini <>

f9e8cacc 04/02/2013 06:47 pm Stefan Hajnoczi

oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()

The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.
Rename to qemu_set_nonblock() just like qemu_set_cloexec().

Signed-off-by: Stefan Hajnoczi <>
Reviewed-by: Eric Blake <>...

f53a1feb 03/22/2013 06:51 pm Kevin Wolf

nbd: Accept -drive options for the network connection

The existing parsers for the file name now parse everything into the
bdrv_open() options QDict. Instead of using these parsers, you can now
directly specify the options on the command line, like this:...

6963a30d 03/22/2013 06:51 pm Kevin Wolf

block: Introduce .bdrv_parse_filename callback

If a driver needs structured data and not just a string, it can provide
a .bdrv_parse_filename callback now that parses the command line string
into separate options. Keeping this separate from .bdrv_open_filename...

bebbf7fa 03/22/2013 06:51 pm Kevin Wolf

nbd: Use default port if only host is specified

The URL method already takes care to apply the default port when none is
specfied. Directly specifying driver-specific options required the port
number until now. Allow leaving it out and apply the default....

681e7ad0 03/22/2013 06:51 pm Kevin Wolf

nbd: Check against invalid option combinations

A file name may only specified if no host or socket path is specified.
The latter two may not appear at the same time either.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

787e4a85 03/22/2013 06:51 pm Kevin Wolf

block: Add options QDict to bdrv_file_open() prototypes

The new parameter is unused yet.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

f17c90be 03/22/2013 06:51 pm Kevin Wolf

nbd: Keep hostname and port separate

The NBD block supports an URL syntax, for which a URL parser returns
separate hostname and port fields. It also supports the traditional qemu
syntax encoded in a filename. Until now, after parsing the URL to get
each piece of information, a new string is built to be fed to socket...

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

1d7d2a9d 11/12/2012 03:38 pm Paolo Bonzini

nbd: accept URIs

The URI syntax is consistent with the Gluster syntax. Export names
are specified in the path, preceded by one or more (otherwise unused)
slashes.

Signed-off-by: Paolo Bonzini <>

d04b0bbb 11/12/2012 12:33 pm Paolo Bonzini

nbd: accept relative path to Unix socket

Adding the "is_unix" member now will simplify the parsing of NBD URIs.

Signed-off-by: Paolo Bonzini <>

2fc8ae1d 06/11/2012 10:12 pm Michael Tokarev

cleanup qemu_co_sendv(), qemu_co_recvv() and friends

The same as for non-coroutine versions in previous
patches: rename arguments to be more obvious, change
type of arguments from int to size_t where appropriate,
and use common code for send and receive paths (with...

b3adf53a 04/26/2012 06:54 pm Kevin Wolf

nbd: Fix uninitialised use of s->sock

s->sock is assigned only afterwards, so we're really registering an
aio_fd_handler for file descriptor 0 here. Not exactly what we intended.

Signed-off-by: Kevin Wolf <>
Signed-off-by: Paolo Bonzini <>

1f8bcac0 04/23/2012 10:27 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

  • kwolf/for-anthony: (38 commits)
    qemu-iotests: Fix test 031 for qcow2 v3 support
    qemu-iotests: Add -o and make v3 the default for qcow2
    qcow2: Zero write support
    qemu-iotests: Test backing file COW with zero clusters...
bafbd6a1 04/19/2012 05:37 pm Paolo Bonzini

aio: remove process_queue callback and qemu_aio_process_queue

Both unused after the previous patch.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

fc19f8a0 04/19/2012 05:36 pm Paolo Bonzini

nbd: consistently check for <0 or >=0

This prepares for the following patch, which changes -1 return values
to negative errno.

Signed-off-by: Paolo Bonzini <>

185b4338 04/19/2012 05:36 pm Paolo Bonzini

nbd: consistently return negative errno values

In the next patch we need to look at the return code of nbd_wr_sync.
To avoid percolating the socket_error() ugliness all around, let's
handle errors by returning negative errno values.

Signed-off-by: Paolo Bonzini <>

7fe7b68b 04/19/2012 05:36 pm Paolo Bonzini

nbd: do not block in nbd_wr_sync if no data at all is available

Right now, nbd_wr_sync will hang if no data at all is available on the
socket and the other side is not going to provide any. Relax this by
making it loop only for writes or partial reads. This fixes a race...

dd3e8ac4 04/19/2012 05:36 pm Paolo Bonzini

nbd: avoid out of bounds access to recv_coroutine array

This can happen with a buggy or malicious server.

Reported-by: Michael Tokarev <>
Signed-off-by: Paolo Bonzini <>

ae255e52 12/22/2011 12:53 pm Paolo Bonzini

nbd: switch to asynchronous operation

Signed-off-by: Paolo Bonzini <>

d9b09f13 12/22/2011 12:53 pm Paolo Bonzini

nbd: split requests

qemu-nbd has a limit of slightly less than 1M per request. Work
around this in the nbd block driver.

Signed-off-by: Paolo Bonzini <>

ecda3447 12/22/2011 12:53 pm Paolo Bonzini

nbd: allow multiple in-flight requests

Allow sending up to 16 requests, and drive the replies to the coroutine
that did the request. The code is written to be exactly the same as
before this patch when MAX_NBD_REQUESTS == 1 (modulo the extra mutex
and state)....

2c7989a9 12/22/2011 12:53 pm Paolo Bonzini

nbd: add support for NBD_CMD_FLAG_FUA

Signed-off-by: Paolo Bonzini <>

1486d04a 12/22/2011 12:53 pm Paolo Bonzini

nbd: add support for NBD_CMD_FLUSH

Signed-off-by: Paolo Bonzini <>

7a706633 12/22/2011 12:53 pm Paolo Bonzini

nbd: add support for NBD_CMD_TRIM

Signed-off-by: Paolo Bonzini <>

3a93113a 12/06/2011 11:56 am Dong Xu Wang

fix typo: delete redundant semicolon

Double semicolons should be single.

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Stefan Hajnoczi <>

2914caa0 10/21/2011 06:34 pm Paolo Bonzini

block: take lock around bdrv_read implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_read implementations to take the mutex.

Drivers that implement bdrv_read rather than bdrv_co_readv can
then benefit from asynchronous operation (at least if the underlying...

e183ef75 10/21/2011 06:34 pm Paolo Bonzini

block: take lock around bdrv_write implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_write implementations to take the mutex.

Drivers that implement bdrv_write rather than bdrv_co_writev can
then benefit from asynchronous operation (at least if the underlying...

848c66e8 10/21/2011 06:34 pm Paolo Bonzini

block: add a CoMutex to synchronous read drivers

The big conversion of bdrv_read/write to coroutines caused the two
homonymous callbacks in BlockDriver to become reentrant. It goes
like this:

1) bdrv_read is now called in a coroutine, and calls bdrv_read or...

b90fb4b8 09/19/2011 12:34 pm Paolo Bonzini

nbd: support feature negotiation

nbd supports writing flags in bytes 24...27 of the header,
and uses that for the read-only flag. Add support for it
in qemu-nbd.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

ab359cd1 09/12/2011 04:17 pm Markus Armbruster

nbd: Clean up use of block_int.h

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

d2d979c6 05/03/2011 12:29 pm Nick Thomas

NBD: Avoid leaking a couple of strings when the NBD device is closed

Signed-off-by: Nick Thomas <>
Signed-off-by: Kevin Wolf <>

33897dc7 04/07/2011 02:51 pm Nick Thomas

NBD device: Separate out parsing configuration and opening sockets.

We also change the way the file parameter is parsed so IPv6 IP
addresses can be used, e.g.: "drive=nbd:[::1]:5000"

Signed-off-by: Nick Thomas <>
Signed-off-by: Kevin Wolf <>

c2e2872b 09/21/2010 04:39 pm Laurent Vivier

nbd: correctly manage default port

block/nbd.c: use default port number when none is specified
qemu-nbd.c: use IANA-assigned port number: 10809

Signed-off-by: Laurent Vivier <>
Signed-off-by: Kevin Wolf <>

1d45f8b5 08/30/2010 07:29 pm Laurent Vivier

nbd: Introduce NBD named exports.

This patch allows to connect Qemu using NBD protocol to an nbd-server
using named exports.

For instance, if on the host "isoserver", in /etc/nbd-server/config, you have:

[generic]
[debian-500-ppc-netinst]
exportname = /ISO/debian-500-powerpc-netinst.iso...

66f82cee 05/03/2010 11:07 am Kevin Wolf

block: Open the underlying image file in generic code

Format drivers shouldn't need to bother with things like file names, but rather
just get an open BlockDriverState for the underlying protocol. This patch
introduces this behaviour for bdrv_open implementation. For protocols which...

9a2d77ad 01/26/2010 11:42 pm Christoph Hellwig

block: kill BDRV_O_CREAT

The BDRV_O_CREAT option is unused inside qemu and partially duplicates
the bdrv_create method. Remove it, and the -C option to qemu-io which
isn't used in qemu-iotests anyway.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Anthony Liguori <>

019d6b8f 05/15/2009 12:13 am Anthony Liguori

Move block drivers into their own directory

Signed-off-by: Anthony Liguori <>