platform/upstream/nbd.git
12 years agonbd-server: block SIGCHLD when handling SIGTERM, and visa versa
Dmitry V. Levin [Thu, 21 Jun 2012 21:45:01 +0000 (01:45 +0400)]
nbd-server: block SIGCHLD when handling SIGTERM, and visa versa

SIGCHLD handler must be blocked during execution of SIGTERM handler,
and visa versa, because the former changes "children" hash table
iterated by the latter.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: fix several memory leaks in connection handling code
Dmitry V. Levin [Thu, 21 Jun 2012 21:44:18 +0000 (01:44 +0400)]
nbd-server: fix several memory leaks in connection handling code

This change fixes a CLIENT leak on normal path in the parent process,
several CLIENT leaks on error path in the parent process, a pid_t leak
on error path in the parent process, and a pid_t leak in the child
process.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: do not call fcntl F_SETFL unnecessarily
Dmitry V. Levin [Thu, 21 Jun 2012 21:43:07 +0000 (01:43 +0400)]
nbd-server: do not call fcntl F_SETFL unnecessarily

Call fcntl F_SETFL only when new file status flags differ from the old one.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: do not lose connections
Dmitry V. Levin [Thu, 21 Jun 2012 21:42:19 +0000 (01:42 +0400)]
nbd-server: do not lose connections

When select reports that more than one connection is ready to be
accepted, handle them all instead of losing all of them but one.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: move connection handling code to a separate function
Dmitry V. Levin [Thu, 21 Jun 2012 21:41:44 +0000 (01:41 +0400)]
nbd-server: move connection handling code to a separate function

The serveloop function has grown too much, and the indentation of
connection handling code unnecessarily complicates further changes.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: treat accept errors as non-fatal
Dmitry V. Levin [Thu, 21 Jun 2012 21:40:48 +0000 (01:40 +0400)]
nbd-server: treat accept errors as non-fatal

In most cases, an error returned by accept system call is a network
error, which should not terminate the whole nbd-server.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: fix accepted connections descriptor initialization and use
Dmitry V. Levin [Thu, 21 Jun 2012 21:40:16 +0000 (01:40 +0400)]
nbd-server: fix accepted connections descriptor initialization and use

Change the value for undefined descriptor from 0 to -1 because
any value greater or equal to 0 can be a valid file descriptor.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: avoid modernsock descriptor leaking to child processes
Dmitry V. Levin [Thu, 21 Jun 2012 21:39:17 +0000 (01:39 +0400)]
nbd-server: avoid modernsock descriptor leaking to child processes

Close modernsock descriptor in child processes.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: fix modernsock descriptor initialization and use
Dmitry V. Levin [Thu, 21 Jun 2012 21:38:40 +0000 (01:38 +0400)]
nbd-server: fix modernsock descriptor initialization and use

Change the value for undefined "modern handler" descriptor from 0 to -1
because any value greater or equal to 0 can be a valid file descriptor.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-server: zeroise hash table pointer after destroying the table
Dmitry V. Levin [Thu, 21 Jun 2012 21:37:40 +0000 (01:37 +0400)]
nbd-server: zeroise hash table pointer after destroying the table

This is required to avoid accessing freed data later in
sigterm_handler.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-client: try harder to reconnect in persist mode
Dmitry V. Levin [Thu, 21 Jun 2012 21:00:28 +0000 (01:00 +0400)]
nbd-client: try harder to reconnect in persist mode

When nbd-client in persist mode is trying to reconnect because of
nbd-server restart, it is highly probable that nbd-server will not be
ready to serve a reconnection request in time causing nbd-client to exit
with "connection refused" diagnostics.  This change makes nbd-client in
persist mode retry its reconnection attempts until succeeded.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-client: adjust the oom-killer score in swap mode
Dmitry V. Levin [Thu, 21 Jun 2012 20:59:22 +0000 (00:59 +0400)]
nbd-client: adjust the oom-killer score in swap mode

In swap mode, it is highly desirable to take all available measures that
could help nbd-client survival in low memory conditions.  One of such
measures is to disable oom killing of nbd-client by adjusting the
oom-killer score.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
12 years agonbd-client: do not leave child processes in the zombie state
Dmitry V. Levin [Fri, 15 Jun 2012 23:43:23 +0000 (03:43 +0400)]
nbd-client: do not leave child processes in the zombie state

Change SIGCHLD handler to SIG_DFL with SA_NOCLDWAIT flag set, to avoid
transforming child processes into zombies when they terminate.  Since
the main process is inevitably blocked in NBD_DO_IT ioctl at the time
when child processes terminate, this is the simplest way to get rid of
zombie processes.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Wouter Verhelst <w@uter.be>
12 years agoDon't kill processes unless we're sure there's actually a process to kill
Wouter Verhelst [Sun, 10 Jun 2012 20:15:11 +0000 (22:15 +0200)]
Don't kill processes unless we're sure there's actually a process to kill

12 years agoAdd some more logging
Wouter Verhelst [Sun, 10 Jun 2012 20:14:42 +0000 (22:14 +0200)]
Add some more logging

12 years agorefer to the correct manpage
Wouter Verhelst [Wed, 30 May 2012 05:49:10 +0000 (07:49 +0200)]
refer to the correct manpage

12 years agoMark test as skipped, rather than as successful
Wouter Verhelst [Mon, 28 May 2012 05:14:15 +0000 (07:14 +0200)]
Mark test as skipped, rather than as successful

12 years agoFix a minor memory leak
Wouter Verhelst [Sat, 26 May 2012 07:09:27 +0000 (09:09 +0200)]
Fix a minor memory leak

The 'next' label does some cleanup, so jump there rather than to the
start of the loop.

12 years agoAdd test for "list exports"
Wouter Verhelst [Fri, 25 May 2012 08:31:32 +0000 (10:31 +0200)]
Add test for "list exports"

occasionally, since this uses the regular nbd-client, it also tests
whether it will at least do something useful, and not crash and burn at
startup. We can't test whether it will connect properly, since we're not
sure we have the environment set up for that completely, but this is a
good idea regardless.

12 years agoUpdates nbd-3.1.1
Wouter Verhelst [Fri, 25 May 2012 07:58:35 +0000 (09:58 +0200)]
Updates

12 years agoPrepare for 3.1.1
Wouter Verhelst [Fri, 25 May 2012 07:50:43 +0000 (09:50 +0200)]
Prepare for 3.1.1

12 years agoInitialize stack variables opts and cflags.
Jason A. Donenfeld [Fri, 25 May 2012 02:36:17 +0000 (04:36 +0200)]
Initialize stack variables opts and cflags.

Without initializing these variables, nbd-client will some of the time
list exports instead of connecting to them, depending on the wing flaps
of a butterfly and cosmic alien rays. The fix is to set the flags to 0
so that nbd-client operates reliably.

12 years agoGroup local headers together beyond the system headers and library headers.
Wouter Verhelst [Sun, 20 May 2012 10:35:35 +0000 (12:35 +0200)]
Group local headers together beyond the system headers and library headers.

12 years agocompat: Define AI_NUMERICSERV as `0' if necessary
Michael Witten [Sat, 19 May 2012 11:00:00 +0000 (11:00 +0000)]
compat: Define AI_NUMERICSERV as `0' if necessary

AI_NUMERICSERV as a value for the `ai_flags' member
of `struct addrinfo' of header <netdb.h> has only
been available since:

  POSIX 1003.1-2008, Issue 7
  glibc 2.3.4
  Mac OS X 10.6
  etc.

Fortunately, its main purpose seems to be only
to optimize calls of `getaddrinfo', and because it
is meant to be a bit flag, it can therefore be
[relatively] safely ignored by defining it to have
the value zero.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
12 years agoInitialize needed_flags
Wouter Verhelst [Sat, 19 May 2012 08:19:20 +0000 (10:19 +0200)]
Initialize needed_flags

otherwise we may end up sending garbage to the negotiation.

12 years agoRemove outdated comment
Wouter Verhelst [Tue, 15 May 2012 08:30:40 +0000 (10:30 +0200)]
Remove outdated comment

12 years agoDocumentation update for list exports nbd-3.1
Wouter Verhelst [Tue, 15 May 2012 08:10:04 +0000 (10:10 +0200)]
Documentation update for list exports

12 years agoPrepare for 3.1
Wouter Verhelst [Tue, 15 May 2012 07:43:42 +0000 (09:43 +0200)]
Prepare for 3.1

12 years agoDon't overdo it on the output
Wouter Verhelst [Sun, 13 May 2012 15:15:52 +0000 (17:15 +0200)]
Don't overdo it on the output

"make check" would produce massive amounts of data, that we don't always
need; and if we do, there's script(1).

Meanwhile, this makes sure we can still scroll up and see what happened
with previous tests.

12 years agoFix alignment issues and build on SPARC
peter green [Tue, 8 May 2012 07:32:53 +0000 (09:32 +0200)]
Fix alignment issues and build on SPARC

nbd-tester-client, in the "integrity" test, was making some assumptions
that were incorrect on architectures such as SPARC which care about
alignment. This patch fixes those, by making sure we always access
64-bit values through a uint64_t, rather than through a char.

12 years agoDon't forget to convert to network byte order
Wouter Verhelst [Sat, 5 May 2012 09:22:11 +0000 (11:22 +0200)]
Don't forget to convert to network byte order

12 years agoMake output somewhat more pretty
Wouter Verhelst [Sat, 5 May 2012 09:22:05 +0000 (11:22 +0200)]
Make output somewhat more pretty

12 years agoImplement "list exports" message
Wouter Verhelst [Sat, 5 May 2012 09:04:39 +0000 (11:04 +0200)]
Implement "list exports" message

Previously, there was no way for the client to get a list of all
available exports from an nbd-server. This implements that.

Additionally, it implements a way for the server to understand more
options than just the one "NBD_OPT_EXPORT_NAME" we did before, and
proper handling of "sorry, I don't know what you're talking about".

12 years agoFix reference to INSTALL file -- oops, that was still open
Wouter Verhelst [Wed, 2 May 2012 15:25:56 +0000 (17:25 +0200)]
Fix reference to INSTALL file -- oops, that was still open

12 years agoFix for device name detection
Jean Wolter [Wed, 2 May 2012 14:46:34 +0000 (16:46 +0200)]
Fix for device name detection

Our nbd devices end up in /dev/block/nbd*. check_conn() tries to
derive the path to the pid file under /sys/block/<nbd device>/pid by
stripping a leading /dev/ path prefix. In our case it ends up with
/sys/block/block/<nbd device>/pid and is unable to locate the pid file.
The attached patch nbd-client-devname.patch uses

        if( (p=strrchr(devname, '/')) ) {
                devname=p+1;
        }

to derive the name of the device.

12 years agoFix for error handling
Jean Wolter [Wed, 2 May 2012 14:43:25 +0000 (16:43 +0200)]
Fix for error handling

When a client disconnects from the nbd device (triggered via nbd-client
-d <nbd device>) the ioctl(nbd, NBD_DO_IT) returns with an error.
nbd-client checks errno to figure out whether it was disconnected and
whether it should terminate or not. Unfortunatly it invokes fprintf()
before checking errno and fprintf overwrites the current value of errno.
The attached patch saves the current value of errno and checks the saved
value.

12 years agoUse the formatted string, not the unformatted one.
Wouter Verhelst [Wed, 21 Mar 2012 15:43:52 +0000 (16:43 +0100)]
Use the formatted string, not the unformatted one.

12 years agoUse less syscalls
Wouter Verhelst [Wed, 21 Mar 2012 11:12:49 +0000 (12:12 +0100)]
Use less syscalls

If we've just done ftruncate, then either we were successful and know
the new file size (and then we don't need an lseek), or we weren't and
then we need to error out anyway.

Doing things this way also avoids another warning in the code.

12 years agoTransition do_oldstyle variable to a global flags mask
Wouter Verhelst [Wed, 21 Mar 2012 11:11:34 +0000 (12:11 +0100)]
Transition do_oldstyle variable to a global flags mask

... in preparation for more global options.

12 years agoUse assert rather than g_assert
Wouter Verhelst [Wed, 21 Mar 2012 11:05:17 +0000 (12:05 +0100)]
Use assert rather than g_assert

12 years agoSupport filesystems that don't return filetypes in readdir()
Wouter Verhelst [Thu, 23 Feb 2012 07:57:41 +0000 (08:57 +0100)]
Support filesystems that don't return filetypes in readdir()

12 years agoDo the check_conn in the child, not the parent nbd-3.0
Wouter Verhelst [Tue, 21 Feb 2012 10:04:32 +0000 (11:04 +0100)]
Do the check_conn in the child, not the parent

12 years agoRelease 3.0
Wouter Verhelst [Fri, 10 Feb 2012 10:24:03 +0000 (11:24 +0100)]
Release 3.0

Also, pull a Linus -- the version number does not seem to make much
sense anymore, so change to 3.x version numbers rather than trying to
stick to the 2.x.y one. Not because it's a major update, but because I
want to start making sense again.

13 years agoMerge pull request #5 from tabraham/master
Wouter Verhelst [Sat, 7 Jan 2012 13:28:00 +0000 (05:28 -0800)]
Merge pull request #5 from tabraham/master

properly check for HAVE_FALLOC_PH define in both occurrences

13 years agoproperly check for HAVE_FALLOC_PH in both occurrences
T.M. Abraham [Sat, 7 Jan 2012 02:58:55 +0000 (21:58 -0500)]
properly check for HAVE_FALLOC_PH in both occurrences

13 years agoMake assertions about state in negotiation function
Wouter Verhelst [Fri, 23 Dec 2011 17:58:54 +0000 (18:58 +0100)]
Make assertions about state in negotiation function

13 years agoImprove indentation to avoid this kind of thing from happening again.
Wouter Verhelst [Tue, 6 Dec 2011 08:46:07 +0000 (09:46 +0100)]
Improve indentation to avoid this kind of thing from happening again.

13 years agonbd-server: use modern alternative to legacy index() function
Peter Korsgaard [Mon, 5 Dec 2011 22:40:42 +0000 (23:40 +0100)]
nbd-server: use modern alternative to legacy index() function

index() was marked as obsolete by susv3, and isn't available on uClibc
in some configurations, so use the equivalent strchr() instead:

http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
13 years agolfs.h: fix !LFS builds
Peter Korsgaard [Mon, 5 Dec 2011 22:32:56 +0000 (23:32 +0100)]
lfs.h: fix !LFS builds

Commit 448637fba4 (Fix 32/64 bit confusion) broke !LFS builds as it
added the PARAM_OFFT defines inside the wrong conditional.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
13 years agoCheck for defines the right way
Wouter Verhelst [Tue, 29 Nov 2011 15:58:02 +0000 (16:58 +0100)]
Check for defines the right way

I keep forgetting that autoconf says '#define FOO 0' rather than '#undef
FOO'...

13 years agoRelease 2.9.25 nbd-2.9.25
Wouter Verhelst [Tue, 29 Nov 2011 07:37:19 +0000 (08:37 +0100)]
Release 2.9.25

13 years agoUse proper values
Wouter Verhelst [Tue, 29 Nov 2011 07:32:33 +0000 (08:32 +0100)]
Use proper values

.required is a gboolean, so specify its value as FALSE rather than 0.
The result is the same, but this reads better...

13 years agoFix this check
Wouter Verhelst [Tue, 29 Nov 2011 07:31:02 +0000 (08:31 +0100)]
Fix this check

Due to a mistake, it was placed in the "if (virtstyle)" case, rather
than always. Whether a user is specifying a virtualization style has
nothing to do with whether they should specify a port number...

13 years agoUpdate manpage
Wouter Verhelst [Thu, 10 Nov 2011 09:21:49 +0000 (10:21 +0100)]
Update manpage

There were some confusing examples at the bottom of the manpage that
were still showing the old ways of doing things. Update them so they no
longer show 'port=' parameters without also showing 'oldstyle=true'.

Via https://forums.gentoo.org/viewtopic-t-896132.html?sid=51ce5d51b9c62fc5d9eecfdaa988ceef

13 years agoBump required version of libglib
Wouter Verhelst [Thu, 3 Nov 2011 21:51:11 +0000 (22:51 +0100)]
Bump required version of libglib

13 years agoUse msg3 instead of msg2 (oops, my mistake)
Wouter Verhelst [Thu, 3 Nov 2011 21:50:29 +0000 (22:50 +0100)]
Use msg3 instead of msg2 (oops, my mistake)

13 years agoFix msg2 calls
Stéphane Graber [Thu, 20 Oct 2011 18:48:34 +0000 (20:48 +0200)]
Fix msg2 calls

13 years agoSave and restore errno before calling functions
Wouter Verhelst [Sun, 2 Oct 2011 09:31:16 +0000 (09:31 +0000)]
Save and restore errno before calling functions

not doing this caused problems on Debian GNU/kFreeBSD

13 years agoImplement TRIM as fallocate(FALLOC_FL_PUNCH_HOLE) call
Wouter Verhelst [Thu, 15 Sep 2011 19:19:12 +0000 (21:19 +0200)]
Implement TRIM as fallocate(FALLOC_FL_PUNCH_HOLE) call

Compile-tested, but not yet functionally tested.

13 years agoFix check for FALLOCATE_FL_PUNCH_HOLE
Wouter Verhelst [Thu, 15 Sep 2011 18:53:34 +0000 (20:53 +0200)]
Fix check for FALLOCATE_FL_PUNCH_HOLE

- We were using AC_COMPILE_IFELSE when there was a perfectly good
  AC_CHECK_DECL specifically for this purpose.
- The check for the result of the header file check used the wrong name
  for the cache variable, so always returned false, so we never checked,
  in fact. D'oh.

It now properly returns true when needed

13 years agoRemove unused variable nbd-2.9.24
Wouter Verhelst [Tue, 13 Sep 2011 17:58:17 +0000 (19:58 +0200)]
Remove unused variable

13 years agoAdd test for config file snippet stuff, and make the server pass it.
Wouter Verhelst [Tue, 13 Sep 2011 11:56:53 +0000 (13:56 +0200)]
Add test for config file snippet stuff, and make the server pass it.

13 years agoDocument trim option in manpage, too.
Wouter Verhelst [Thu, 8 Sep 2011 16:42:52 +0000 (18:42 +0200)]
Document trim option in manpage, too.

13 years agoadd support for NBD_CMD_TRIM, update docs
Paolo Bonzini [Thu, 8 Sep 2011 10:05:46 +0000 (12:05 +0200)]
add support for NBD_CMD_TRIM, update docs

Update the protocol documentation, and implement it as a dummy
command in the server.

13 years agoFix error handling
Wouter Verhelst [Mon, 5 Sep 2011 23:26:35 +0000 (01:26 +0200)]
Fix error handling

13 years agoFix size_t/socklen_t confusion.
Wouter Verhelst [Mon, 5 Sep 2011 23:13:13 +0000 (01:13 +0200)]
Fix size_t/socklen_t confusion.

13 years agoUpdate config file format description
Wouter Verhelst [Thu, 25 Aug 2011 00:16:14 +0000 (02:16 +0200)]
Update config file format description

13 years agoAdd missing include
Wouter Verhelst [Sat, 27 Mar 2010 16:35:25 +0000 (16:35 +0000)]
Add missing include

otherwise ntohl isn't defined, which means breakage later on.

13 years agoPortability fix
Wouter Verhelst [Sat, 27 Mar 2010 16:31:07 +0000 (16:31 +0000)]
Portability fix

RFC3493 ("Basic Socket Interface Extensions for IPv6") only specifies the
s6_addr member of struct in6_addr, nothing more; and e.g., FreeBSD does
not implement s6_addr32 as visible by anything but the kernel.

Since we want nbd-server to be portable, only use the 8-bit version
here. There will be a slight performance penalty, but not a noticeable
one.

13 years agoCheck for fdatasync before trying to use it
Wouter Verhelst [Wed, 17 Aug 2011 21:37:22 +0000 (23:37 +0200)]
Check for fdatasync before trying to use it

13 years agoPrepare for 2.9.24 (not released yet)
Wouter Verhelst [Mon, 8 Aug 2011 05:46:36 +0000 (07:46 +0200)]
Prepare for 2.9.24 (not released yet)

13 years agoFix checking for generic section in individual files
Wouter Verhelst [Mon, 8 Aug 2011 05:45:43 +0000 (07:45 +0200)]
Fix checking for generic section in individual files

13 years agoRe-sort, and add documentation on new includedir option.
Wouter Verhelst [Tue, 2 Aug 2011 17:05:47 +0000 (19:05 +0200)]
Re-sort, and add documentation on new includedir option.

13 years agoImplement config.d style config management
Wouter Verhelst [Tue, 2 Aug 2011 16:56:55 +0000 (18:56 +0200)]
Implement config.d style config management

13 years agoTest for presence of FALLOC_FL_PUNCH_HOLE
Wouter Verhelst [Fri, 22 Jul 2011 13:31:17 +0000 (15:31 +0200)]
Test for presence of FALLOC_FL_PUNCH_HOLE

In preparation for protocol support for this

13 years agoRemove outdated comments
Wouter Verhelst [Fri, 22 Jul 2011 13:14:56 +0000 (15:14 +0200)]
Remove outdated comments

13 years agoDon't forget to include stdbool if we're going to use it.
Wouter Verhelst [Fri, 22 Jul 2011 09:23:33 +0000 (11:23 +0200)]
Don't forget to include stdbool if we're going to use it.

13 years agoReport more often on our progress
Wouter Verhelst [Thu, 21 Jul 2011 13:26:48 +0000 (15:26 +0200)]
Report more often on our progress

Debian autobuild software has an inactivity timer that is dependent on
produced output, which we're hitting sometimes currently. Multiply the
amount of time we output something by a factor 10, so that we're less
likely to.

13 years agoFix 32/64 bit confusion
Wouter Verhelst [Thu, 21 Jul 2011 07:51:33 +0000 (07:51 +0000)]
Fix 32/64 bit confusion

13 years agoLog occurrance of oversized request only once, so that the integrityhuge check doesn...
Wouter Verhelst [Thu, 21 Jul 2011 07:47:50 +0000 (09:47 +0200)]
Log occurrance of oversized request only once, so that the integrityhuge check doesn't take forever

13 years agoMerge remote-tracking branch 'debian/master'
Wouter Verhelst [Wed, 20 Jul 2011 16:58:03 +0000 (18:58 +0200)]
Merge remote-tracking branch 'debian/master'

13 years agoDebugging improvements, and fix running on on (Debian/k)FreeBSD
Wouter Verhelst [Wed, 20 Jul 2011 16:52:01 +0000 (16:52 +0000)]
Debugging improvements, and fix running on on (Debian/k)FreeBSD

We had 12 instances of err("Negotiation failed:"), which makes it kinda
hard to figure out which one exactly is failing. Make it clearer by
numbering them.

Also, the test suite failed on FreeBSD because we set the listening
socket to O_NONBLOCK, but don't actually handle EAGAIN in the
negotiation then. This is silly, so stop doing O_NONBLOCK (it's not like
it's helping us anyway)

13 years agoRelease 2.9.23 nbd-2.9.23
Wouter Verhelst [Fri, 8 Jul 2011 11:13:35 +0000 (13:13 +0200)]
Release 2.9.23

13 years agoUpdate copyright statement -- apparently I forgot this like forever :-)
Wouter Verhelst [Sat, 25 Jun 2011 10:18:00 +0000 (12:18 +0200)]
Update copyright statement -- apparently I forgot this like forever :-)

13 years agoFix typo
Wouter Verhelst [Sat, 25 Jun 2011 08:16:49 +0000 (10:16 +0200)]
Fix typo

13 years agoAdd "temporary" option, and ability to create files.
Alex Bligh [Tue, 31 May 2011 08:47:23 +0000 (09:47 +0100)]
Add "temporary" option, and ability to create files.

This commit:
* Adds a "temporary" option, which causes a unique file to be
  created, which is unliked as soon as it is created (and thus
  will not be present on exit). This is used for creation of
  temporary disks.
* Will create a file, if "filesize" is specified and the file
  is not present or is zero length (useful in conjunction with the
  above).

13 years agoRemove unused assignment
Wouter Verhelst [Sun, 12 Jun 2011 10:56:35 +0000 (12:56 +0200)]
Remove unused assignment

13 years agoRemove dead assignment
Wouter Verhelst [Sun, 12 Jun 2011 10:54:19 +0000 (12:54 +0200)]
Remove dead assignment

This used to be part of option handling, but is dead and useless since
we switched option handling to getopt() calls.

13 years agoAdd missing break
Wouter Verhelst [Sun, 12 Jun 2011 10:51:07 +0000 (12:51 +0200)]
Add missing break

13 years agoMake integrity tests respect request ordering.
Alex Bligh [Mon, 6 Jun 2011 20:34:52 +0000 (21:34 +0100)]
Make integrity tests respect request ordering.

Prior to this patch, the integrity test fired reads and writes as
quickly as they could at the server. This included firing overlapping
reads and writes, before the prior read or write was acknowledged.
Under the protocol, the server is permitted to reorder reads and
writes until they are acknowledged. Whilst nbd-server does not
currently reorder reads or writes, this caused a "false failure"
in other servers that do reorder reads and writes. Also, the workload
as sent was unrealistic (in that servers do not normally have
overlapping reads and writes in their queue).

This patch maintains a record of the reads and writes inflight, and
ensures that:

1. If any block X is covered by an inflight write request, then
   no other request covering block X will be sent until a reply
   to such inflight write is received.

2. If any block X is covered by an inflight read or write request,
   then no write request covering block X will be sent until a reply
   to such inflight request is received.

In otherwords, disallow all overlapping inflight requests, except
overlapping inflight reads, which are permitted.

The "-l" option to nbd-tester-client can be used to turn on
looseordering, IE not do the above.

I have tested this on nbd-server (no change as expected) and on
a server which does reorder requests (which now passes the tests).

13 years agonbd-tester-client: analyse bad data using hash function huersistic
Alex Bligh [Sun, 5 Jun 2011 16:57:16 +0000 (17:57 +0100)]
nbd-tester-client: analyse bad data using hash function huersistic

The hash function used by the integrity test was designed specifically
such that with < (2^32) blocks and < (2^32) read/write operations, it
can accurately guess how the bad data returned was generated. This
patch uses this huersistic to provide a guess as to what is wrong.
EG if it prints out a correct block number but a bad sequence number,
it is likely the server is disordering writes or has missed writes.

13 years agonbd-tester-client: ignore SIGPIPE so we pick up and print the error
Alex Bligh [Sun, 5 Jun 2011 15:15:49 +0000 (16:15 +0100)]
nbd-tester-client: ignore SIGPIPE so we pick up and print the error

13 years agoFix a few branch checks
Wouter Verhelst [Thu, 9 Jun 2011 14:16:44 +0000 (16:16 +0200)]
Fix a few branch checks

There were still two errors in the ifs in negotiate() that made 'make
check fail'. It works again now.

13 years agoRemove some more crack
Wouter Verhelst [Thu, 9 Jun 2011 14:08:24 +0000 (16:08 +0200)]
Remove some more crack

- Don't touch values unless they're actually set in the config file
- Remove silly test for port thing. This is broken in so many ways, I'm
  not even going to try explaining it anymore.

13 years agoImplement proper branches
Wouter Verhelst [Thu, 9 Jun 2011 13:56:54 +0000 (15:56 +0200)]
Implement proper branches

Trying to implement differing negotiation based on parameters that just
happen to be there is a bad strategy, as this bug demonstrates.

Instead, add a parameter to the negotiate() function that is a bitmask
telling us which part of the negotiation we would like to see: modern vs
oldstyle, initial phase versus 'the rest'.

This doesn't actually survive 'make check' yet, because of a different
bit of crack that's still in there. Different bug, different commit.

13 years agoUpdate proto.txt
Wouter Verhelst [Tue, 31 May 2011 07:35:07 +0000 (09:35 +0200)]
Update proto.txt

Minor difference: we now allow new-style handshakes on nonstandard
ports, so hrm. That's not part of the standard, really, but oh well.

Also, unignore the doc directory, ignore doc/doxygen-output instead.

13 years agoAllow varying the port for new-style handshakes
Wouter Verhelst [Sun, 29 May 2011 09:55:19 +0000 (11:55 +0200)]
Allow varying the port for new-style handshakes

which is useful for debugging purposes.

13 years agoMore sorting
Wouter Verhelst [Sun, 29 May 2011 09:43:11 +0000 (11:43 +0200)]
More sorting

13 years agoDon't send to syslog from nbd-trdump nbd-2.9.22
Wouter Verhelst [Sun, 29 May 2011 07:56:17 +0000 (09:56 +0200)]
Don't send to syslog from nbd-trdump

- we don't include the necessary headers
- it's less than useful here

13 years agoMakefile changes
Wouter Verhelst [Sun, 29 May 2011 07:08:29 +0000 (09:08 +0200)]
Makefile changes

- Add make-integrityhuge to EXTRA_PROGRAMS (so it doesn't get installed,
  but its source will be part of 'make dist')
- Remove knbd-client, leftover of a failed attempt at building
  nbd-client against klibc.