search for: nbd_reply_raw

Displaying 20 results from an estimated 22 matches for "nbd_reply_raw".

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 = -1;...
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.mag...
2017 Dec 04
1
[nbdkit PATCH] nbd: Fix sporadic use-after-free
...rans->u.cookie, req_buf) == 0) - return trans->u.fds[0]; + if (nbd_request_raw (h, type, offset, count, cookie, req_buf) == 0) + return fd; + trans = find_trans_by_cookie (h, cookie); + if (!trans) + return nbd_mark_dead (h); err: err = errno; @@ -309,7 +336,6 @@ static int nbd_reply_raw (struct handle *h, int *fd) { struct reply rep; - struct transaction **ptr; struct transaction *trans; void *buf; uint32_t count; @@ -320,16 +346,7 @@ nbd_reply_raw (struct handle *h, int *fd) if (be32toh (rep.magic) != NBD_REPLY_MAGIC) return nbd_mark_dead (h); nbdkit_debu...
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 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
2017 Dec 02
1
[nbdkit PATCH v2] nbd: Fix memory leak
...9dd668bc3423a Signed-off-by: Eric Blake <eblake@redhat.com> --- plugins/nbd/nbd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c index b844bf5..e79042c 100644 --- a/plugins/nbd/nbd.c +++ b/plugins/nbd/nbd.c @@ -311,6 +311,8 @@ nbd_reply_raw (struct handle *h, int *fd) struct reply rep; struct transaction **ptr; struct transaction *trans; + void *buf; + uint32_t count; *fd = -1; if (read_full (h->fd, &rep, sizeof rep) < 0) @@ -334,9 +336,12 @@ nbd_reply_raw (struct handle *h, int *fd) } *fd = trans-&g...
2017 Nov 17
2
Re: [nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
This one introduces a warning (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
2019 Mar 08
0
Re: [PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...ese later ones in hex or via a helper macro that does ((1 << 15) | value)? Or would that mess up the generated protocol-to-lookup magic? > +++ b/plugins/nbd/nbd.c > @@ -345,7 +345,7 @@ nbd_request (struct handle *h, uint16_t flags, uint16_t type, uint64_t offset, > static int > nbd_reply_raw (struct handle *h, int *fd) > { > - struct reply rep; > + struct simple_reply rep; > struct transaction *trans; > void *buf; > uint32_t count; > @@ -353,7 +353,7 @@ nbd_reply_raw (struct handle *h, int *fd) > *fd = -1; > if (read_full (h->fd, &rep...
2019 Mar 08
2
[PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...BD commands. */ extern const char *name_of_nbd_cmd (int); diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c index 674f4a4..2f494cd 100644 --- a/plugins/nbd/nbd.c +++ b/plugins/nbd/nbd.c @@ -345,7 +345,7 @@ nbd_request (struct handle *h, uint16_t flags, uint16_t type, uint64_t offset, static int nbd_reply_raw (struct handle *h, int *fd) { - struct reply rep; + struct simple_reply rep; struct transaction *trans; void *buf; uint32_t count; @@ -353,7 +353,7 @@ nbd_reply_raw (struct handle *h, int *fd) *fd = -1; if (read_full (h->fd, &rep, sizeof rep) < 0) return nbd_mark_de...
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; + uint64_t...
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 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
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:
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 Dec 02
2
[nbdkit PATCH] nbd: Fix memory leak
...e check-valgrind' fails for TESTS=test-nbd, but this at least avoids the memory leak. plugins/nbd/nbd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c index b844bf5..425abe4 100644 --- a/plugins/nbd/nbd.c +++ b/plugins/nbd/nbd.c @@ -334,6 +334,7 @@ nbd_reply_raw (struct handle *h, int *fd) } *fd = trans->u.fds[1]; + free (trans); switch (be32toh (rep.error)) { case NBD_SUCCESS: if (trans->buf && read_full (h->fd, trans->buf, trans->count) < 0) @@ -399,6 +400,7 @@ nbd_reader (void *handle) abort (); }...
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
2018 Dec 07
0
[nbdkit PATCH 6/5] nbd: More debug details
...fset %#" PRIx64 + ", count %#x, cookie %#" PRIx64, type, name_of_nbd_cmd(type), + flags, offset, count, cookie); r = write_full (h->fd, &req, sizeof req); if (buf && !r) r = write_full (h->fd, buf, count); @@ -353,7 +354,8 @@ nbd_reply_raw (struct handle *h, int *fd) return nbd_mark_dead (h); if (be32toh (rep.magic) != NBD_REPLY_MAGIC) return nbd_mark_dead (h); - nbdkit_debug ("received reply for cookie %#" PRIx64, rep.handle); + nbdkit_debug ("received reply for cookie %#" PRIx64 ", status %s&...
2017 Dec 02
0
Re: [nbdkit PATCH] nbd: Fix memory leak
...d, but this at least avoids the memory leak. > > plugins/nbd/nbd.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c > index b844bf5..425abe4 100644 > --- a/plugins/nbd/nbd.c > +++ b/plugins/nbd/nbd.c > @@ -334,6 +334,7 @@ nbd_reply_raw (struct handle *h, int *fd) > } > > *fd = trans->u.fds[1]; > + free (trans); > switch (be32toh (rep.error)) { > case NBD_SUCCESS: > if (trans->buf && read_full (h->fd, trans->buf, trans->count) < 0) > @@ -399,6 +400,7 @@ nbd_reade...
2018 Dec 07
1
Re: [nbdkit PATCH 6/5] nbd: More debug details
...", count %#x, cookie %#" PRIx64, type, name_of_nbd_cmd(type), > + flags, offset, count, cookie); > r = write_full (h->fd, &req, sizeof req); > if (buf && !r) > r = write_full (h->fd, buf, count); > @@ -353,7 +354,8 @@ nbd_reply_raw (struct handle *h, int *fd) > return nbd_mark_dead (h); > if (be32toh (rep.magic) != NBD_REPLY_MAGIC) > return nbd_mark_dead (h); > - nbdkit_debug ("received reply for cookie %#" PRIx64, rep.handle); > + nbdkit_debug ("received reply for cookie %#"...
2018 Dec 06
10
[PATCH nbdkit 0/5] protocol: Generate map functions from NBD protocol flags to printable strings.
With some crufty sed scripts we can generate functions that map from NBD protocol flags (eg. NBD_CMD_READ) to strings ("NBD_CMD_READ"). This works on GNU sed and with FreeBSD, also with GNU sed's --posix option, so I guess the sed code is POSIX-compatible. Rich.