Fixes for various issues found while implementing my nbd forwarder plugin. I'm okay if you choose to take some but not others; the most important one is patch 3 which fixes a protocol violation that makes it impossible for a client to try and recover from EIO failures over a partially-flaky source block device. Eric Blake (3): maint: Add emacs hint file maint: Add NBDKIT_GDB support to in-tree nbdkit script connections: Don't send NBD_CMD_READ payload on error .dir-locals.el | 1 + nbdkit.in | 9 +++++++-- src/connections.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .dir-locals.el -- 2.13.6
Eric Blake
2017-Nov-13 16:52 UTC
[Libguestfs] [nbdkit PATCH 1/3] maint: Add emacs hint file
Let emacs know that this project prefers space rather than TAB indentation. Signed-off-by: Eric Blake <eblake@redhat.com> --- .dir-locals.el | 1 + 1 file changed, 1 insertion(+) create mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..c9c3aff --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1 @@ +((c-mode . ((indent-tabs-mode . nil)))) -- 2.13.6
Eric Blake
2017-Nov-13 16:52 UTC
[Libguestfs] [nbdkit PATCH 2/3] maint: Add NBDKIT_GDB support to in-tree nbdkit script
During development, it is handy to use the ./nbdkit script to automatically pick up the just-built binaries without having to install things; but using gdb on a script does not work. Similar to how we already support $NBDKIT_VALGRIND, add support for $NBDKIT_GDB; and also make the script robust to a value of $prefix inherited from the environment. Signed-off-by: Eric Blake <eblake@redhat.com> --- nbdkit.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nbdkit.in b/nbdkit.in index 167d512..6be89ec 100644 --- a/nbdkit.in +++ b/nbdkit.in @@ -99,11 +99,16 @@ if [ $verbose ]; then echo $b/src/nbdkit "${args[@]}" fi +prefix # If NBDKIT_VALGRIND=1 is set in the environment, then we run # the program under valgrind. This is used by the tests. +# Similarly, if NBDKIT_GDB=1 is set in the environment, we run +# the program under gdb, useful during development. if [ "$NBDKIT_VALGRIND" ]; then - valgrind="@VALGRIND@ --vgdb=no --leak-check=full --error-exitcode=119 --suppressions=$s/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes --run-libc-freeres=no" + prefix="@VALGRIND@ --vgdb=no --leak-check=full --error-exitcode=119 --suppressions=$s/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes --run-libc-freeres=no" +elif [ "$NBDKIT_GDB" ]; then + prefix="gdb --args" fi # Run the final command. -exec $valgrind $b/src/nbdkit "${args[@]}" +exec $prefix $b/src/nbdkit "${args[@]}" -- 2.13.6
Eric Blake
2017-Nov-13 16:52 UTC
[Libguestfs] [nbdkit PATCH 3/3] connections: Don't send NBD_CMD_READ payload on error
The NBD spec was clarified to state that a payload for NBD_CMD_READ must NOT be sent unless the error field is zero (see https://github.com/NetworkBlockDevice/nbd/commit/e6c6fb39); doing this makes us compatible with nbd-server and qemu-nbd. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/connections.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections.c b/src/connections.c index 8d65e2a..46609f0 100644 --- a/src/connections.c +++ b/src/connections.c @@ -1016,7 +1016,7 @@ recv_request_send_reply (struct connection *conn) } /* Send the read data buffer. */ - if (cmd == NBD_CMD_READ) { + if (cmd == NBD_CMD_READ && !error) { r = conn->send (conn, buf, count); if (r == -1) { nbdkit_error ("write data: %m"); -- 2.13.6
Richard W.M. Jones
2017-Nov-14 10:21 UTC
Re: [Libguestfs] [nbdkit PATCH 0/3] various nbdkit patches
Thanks, I pushed this series. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Seemingly Similar Threads
- [PATCH nbdkit v3 0/4] build: Replace ./nbdkit with a C program.
- [PATCH 0/2] build: Replace ./nbdkit with a C program.
- [PATCH nbdkit v2 0/2] build: Replace ./nbdkit with a C program.
- [nbdkit PATCH] nbd: Add new nbd forwarding plugin
- [PATCH nbdkit 0/4] Multiple valgrind improvements and possible security fix.