Displaying 20 results from an estimated 20 matches for "nbd_reply".
2019 May 25
1
[nbdkit PATCH] nbd: Rewrite thread passing to use semaphore rather than pipe
...er's non-negative answer (converted to local errno
value) on success, or -1 on read failure. If structured replies
- were negotiated, fd is set to -1 if there are still more replies
+ were negotiated, trans_out is set to NULL if there are still more replies
expected. */
static int
-nbd_reply_raw (struct handle *h, int *fd)
+nbd_reply_raw (struct handle *h, struct transaction **trans_out)
{
union {
struct simple_reply simple;
@@ -387,7 +382,7 @@ nbd_reply_raw (struct handle *h, int *fd)
bool zero = false; /* if len, whether to read or memset */
uint16_t errlen;
- *fd =...
2017 Nov 17
2
Re: [nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
...ng (error because I'm using -Werror):
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../src -Wall -Werror -g -O2 -MT nbdkit_nbd_plugin_la-nbd.lo -MD -MP -MF .deps/nbdkit_nbd_plugin_la-nbd.Tpo -c nbd.c -fPIC -DPIC -o .libs/nbdkit_nbd_plugin_la-nbd.o
nbd.c: In function ‘nbd_reply’:
nbd.c:306:19: error: ‘trans.cookie’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
assert (err < 0 || cookie == trans.cookie);
^~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:531: nbdkit_nbd_plugin_la-nbd.lo] Error 1
Rich.
-...
2017 Nov 14
0
[nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
...64_t offset, uint32_t count)
+{
+ return nbd_request_full (h, type, offset, count, NULL, NULL);
+}
+
+/* Read a reply, and look up the corresponding transaction. Return
+ the server's non-negative answer (converted to local errno value)
+ on success, or -1 on read failure. */
+static int
+nbd_reply_raw (struct handle *h, struct transaction *trans)
+{
+ struct reply rep;
+
+ if (read_full (h->fd, &rep, sizeof rep) < 0)
+ return nbd_mark_dead (h);
+ *trans = h->trans;
+ nbdkit_debug ("received reply for cookie %#" PRIx64, rep.handle);
+ if (be32toh (rep.magic) !=...
2017 Nov 14
8
[nbdkit PATCH v2 0/2] add nbd plugin
I'm still working on the interleaving (and Rich reminded me on IRC
that we still don't have THREAD_MODEL_PARALLEL working anywhere
yet, anyways). Since nbdkit doesn't really have a parallel plugin
yet, my testing on that front will have to use qemu-nbd as the
original server, as well as qemu-io as the driver (qemu-io's
aio_read and aio_write commands can be used to trigger
2017 Nov 12
6
[nbdkit PATCH] nbd: Add new nbd forwarding plugin
...;
+ if (h->dead) {
+ nbdkit_set_error (ESHUTDOWN);
+ return -1;
+ }
+ nbdkit_debug ("sending request with type %d and cookie %" PRIu64, type,
+ *cookie);
+ r = write_full (h->fd, &req, sizeof req);
+ if (r < 0)
+ h->dead = true;
+ return r;
+}
+
+static int nbd_reply (struct handle *h, uint64_t cookie)
+{
+ struct reply rep;
+
+ if (read_full (h->fd, &rep, sizeof rep) < 0) {
+ h->dead = true;
+ return -1;
+ }
+ nbdkit_debug ("received reply for cookie %" PRIu64, cookie);
+ if (be32toh (rep.magic) != NBD_REPLY_MAGIC ||
+ be...
2020 Mar 19
1
[nbdkit PATCH] nbd: Drop nbd-standalone fallback
...reply, and look up the corresponding transaction.
- Return the server's non-negative answer (converted to local errno
- value) on success, or -1 on read failure. If structured replies
- were negotiated, trans_out is set to NULL if there are still more replies
- expected. */
-static int
-nbd_reply_raw (struct handle *h, struct transaction **trans_out)
-{
- union {
- struct nbd_simple_reply simple;
- struct nbd_structured_reply structured;
- } rep;
- struct transaction *trans;
- void *buf = NULL;
- CLEANUP_FREE char *payload = NULL;
- uint32_t count;
- uint32_t id;
- struct nbd_...
2018 Jan 16
9
[nbdkit PATCH 0/7] Initial implementation of FUA flag passthrough
Tested via:
term1$ qemu-nbd -k $PWD/sock -t -f raw -x foo junk --trace=nbd_\*
term2$ ./nbdkit -f -v -e bar nbd socket=$PWD/sock export=foo
term3$ qemu-io -t none -f raw nbd://localhost:10809/bar --trace=nbd_\*
and checking the traces to see that 'w 0 1' vs. 'w -f 0 1' was able
to influence whether the FUA flag showed up at the server in term1.
Still to go: figure out how to
2017 Nov 14
0
[nbdkit PATCH v2 2/2] nbd: Split reading into separate thread
...>trans.cookie;
+ goto err;
+ return h->trans.u.fds[0];
+
+ err:
+ err = errno;
+ close (h->trans.u.fds[0]);
+ close (h->trans.u.fds[1]);
+ errno = err;
+ return nbd_mark_dead (h);
}
/* Shorthand for nbd_request_full when no extra buffers are involved. */
@@ -258,9 +290,11 @@ nbd_reply_raw (struct handle *h, struct transaction *trans)
if (read_full (h->fd, &rep, sizeof rep) < 0)
return nbd_mark_dead (h);
+ nbd_lock (h);
*trans = h->trans;
+ nbd_unlock (h);
nbdkit_debug ("received reply for cookie %#" PRIx64, rep.handle);
- if (be32toh (rep...
2019 May 30
5
[nbdkit PATCH 0/4] Play with libnbd for nbdkit-add
Patch 1 played with an early draft of Rich's Fedora 30 libnbd package:
https://bugzilla.redhat.com/show_bug.cgi?id=1713767#c17
Note that comment 21 provides a newer package 0.1.1-1 with a different
API; and that libnbd has more unreleased API changes in the pipeline
(whether that will be called 0.2 or 0.1.2); so we'll have to tweak
things based on what is actually available in distros.
2019 Jun 02
5
[nbdkit PATCH v2 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.2-1 is now available in Fedora 29/30 updates-testing,
although it was not compiled against libxml2 so it lacks uri support
(I ended up testing patch 4 with a self-built libnbd).
Diffs since v1 - rebase to master, bump from libnbd 0.1 to 0.1.2, add
URI support, better timing results
Still not done - patch 5 needs associated tests
Eric Blake (5):
nbd: Check for libnbd
nbd:
2019 Apr 25
6
[nbdkit PATCH v2 0/5] structured replies/.extents for nbd plugin
Updated based on other changes that have happened in the meantime:
- rely more on cleanup.h (throughout)
- split structured read for easier review (patch 2 and 3 were combined in v1)
- rely on nbdkit not leaking a server's partial answer (patch 3)
- add tests (patch 5)
- other bug fixes I found while testing it
- drop EOVERFLOW patch for now; it will be separate once upstream
NBD protocol
2019 Jun 12
8
[nbdkit PATCH v3 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.4-1 is now available in Fedora 29/30 updates testing.
Diffs since v2 - rebase to master, bump from libnbd 0.1.2 to 0.1.3+,
add tests to TLS usage which flushed out the need to turn relative
pathnames into absolute, doc tweaks
Now that the testsuite covers TLS and libnbd has been fixed to provide
the things I found lacking when developing v2, I'm leaning towards
pushing this on
2019 Apr 23
12
[nbdkit PATCH 0/7] Implement structured replies in nbd plugin
I'm hoping to implement .extents for the nbd plugin; this is a
prerequisite. I'm not sure about patch 3 - if we like it, I'll
squash it to 2, if we don't, I think we are okay just dropping
it. I'm also wondering if we have to worry about malicious
plugins that don't populate the entire .pread buffer in an
effort to get nbdkit to expose portions of the heap; my patch 7
loses
2017 Nov 21
6
[nbdkit PATCH v2 0/4] enable parallel nbd forwarding
With this, I am finally able to get the nbd plugin to do out-of-order
responses to the client. Once this series goes in, we should be
ready for Rich to cut a release.
Eric Blake (4):
nbd: Split reading into separate thread
nbd: Protect writes with mutex
nbd: Enable parallel handling
tests: Test parallel nbd behavior
plugins/nbd/nbd.c | 217
2019 Apr 23
0
[nbdkit PATCH 6/7] nbd: Implement NBD_OPT_GO client request
.../plugins/nbd/nbd.c
@@ -1,5 +1,5 @@
/* nbdkit
- * Copyright (C) 2017-2018 Red Hat Inc.
+ * Copyright (C) 2017-2019 Red Hat Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -453,6 +453,158 @@ nbd_reply (struct handle *h, int fd)
return err ? -1 : 0;
}
+static int
+nbd_newstyle_recv_option_reply (struct handle *h, uint32_t option,
+ struct fixed_new_option_reply *reply,
+ char **payload)
+{
+ char *buffer;
+
+ if (payload)
+ *...
2019 Apr 23
0
[nbdkit PATCH 7/7] nbd: Implement structured replies
...nsaction.
Return the server's non-negative answer (converted to local errno
- value) on success, or -1 on read failure. */
+ value) on success, or -1 on read failure. If structured replies
+ were negotiated, fd is set to -1 if there are still more replies
+ expected. */
static int
nbd_reply_raw (struct handle *h, int *fd)
{
- struct simple_reply rep;
+ union {
+ struct simple_reply simple;
+ struct structured_reply structured;
+ } rep;
struct transaction *trans;
- void *buf;
+ void *buf = NULL;
uint32_t count;
+ int error = NBD_SUCCESS;
+ bool more = false;
+ uint...
2019 May 10
11
[nbdkit PATCH 0/9] RFC: implement NBD_CMD_CACHE
I'm still working my way through the filters before this series will
be complete, but this is enough of a start to at least get some
feedback on the idea of implementing another NBD protocol extension.
Eric Blake (9):
server: Internal hooks for implementing NBD_CMD_CACHE
plugins: Add .cache callback
file, split: Implement .cache with posix_fadvise
nbd: Implement NBD_CMD_CACHE
2018 Jan 19
16
[nbdkit PATCH v2 00/13] Add filters + FUA support to nbdkit
A combination of the work that both Rich and I have been doing
lately, where filters use only the new API with flags on every
command that the client can send over the wire (we can then
add support for more flags in nbdkit without having to add new
callbacks, as NBD adds more flags upstream).
Eric Blake (4):
protocol: Split flags from cmd field in requests
backend: Pass flags argument through
2018 Mar 08
19
[nbdkit PATCH v3 00/15] Add FUA support to nbdkit
After more than a month since v2 [1], I've finally got my FUA
support series polished. This is all of my outstanding patches,
even though some of them were originally posted in separate
threads from the original FUA post [2], [3]
[1] https://www.redhat.com/archives/libguestfs/2018-January/msg00113.html
[2] https://www.redhat.com/archives/libguestfs/2018-January/msg00219.html
[3]
2019 May 16
27
[nbdkit PATCH v2 00/24] implement NBD_CMD_CACHE
Since v1:
- rework .can_cache to be tri-state, with default of no advertisement
(ripple effect through other patches)
- add a lot more patches in order to round out filter support
And in the meantime, Rich pushed NBD_CMD_CACHE support into libnbd, so
in theory we now have a way to test cache commands through the entire
stack.
Eric Blake (24):
server: Internal hooks for implementing