Displaying 20 results from an estimated 21 matches for "nbd_reply_mag".
Did you mean:
nbd_reply_magic
2019 Mar 08
2
[PATCH nbdkit] Minimal implementation of NBD Structured Replies.
..._REPLY 8
extern const char *name_of_nbd_rep (int);
#define NBD_REP_ACK 1
@@ -144,15 +145,49 @@ struct request {
uint32_t count; /* Request length. */
} __attribute__((packed));
-/* Reply (server -> client). */
-struct reply {
- uint32_t magic; /* NBD_REPLY_MAGIC. */
+/* Simple reply (server -> client). */
+struct simple_reply {
+ uint32_t magic; /* NBD_SIMPLE_REPLY_MAGIC. */
uint32_t error; /* NBD_SUCCESS or one of NBD_E*. */
uint64_t handle; /* Opaque handle. */
} __attribute__((packed));
-#define NB...
2019 Mar 08
0
Re: [PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...p;
> 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_dead (h);
> - if (be32toh (rep.magic) != NBD_REPLY_MAGIC)
> + if (be32toh (rep.magic) != NBD_SIMPLE_REPLY_MAGIC)
> return nbd_mark_dead (h);
> nbdkit_debug ("received reply for cookie %#" PRIx64 ", status %s",
> rep.handle, name_of_nbd_error(be32toh (rep.error)));
Teaching the nbd plugin to neg...
2017 Nov 14
0
[nbdkit PATCH v2 2/2] nbd: Split reading into separate thread
...t 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.magic) != NBD_REPLY_MAGIC || rep.handle != trans->cookie)
+ if (be32toh (rep.magic) != NBD_REPLY_MAGIC || rep.handle != trans->u.cookie)
return nbd_mark_dead (h);
switch (be32toh (rep.error)) {
case NBD_SUCCESS:
@@ -295,17 +329,52 @@ nbd_reply_raw (struct handle *h, struct transaction *trans)
}
}
+/...
2017 Dec 04
1
[nbdkit PATCH] nbd: Fix sporadic use-after-free
...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_debug ("received reply for cookie %#" PRIx64, rep.handle);
- nbd_lock (h);
- ptr = &h->trans;
- while ((trans = *ptr) != NULL) {
- if (rep.handle == trans->u.cookie)
- break;
- ptr = &trans->next;
- }
- if (trans...
2023 Mar 03
3
[PATCH] docs: Prefer 'cookie' over 'handle'
...bits, type
-C: 64 bits, handle
+C: 64 bits, cookie
C: 64 bits, offset (unsigned)
C: 32 bits, length (unsigned)
C: (*length* bytes of data if the request is of type `NBD_CMD_WRITE`)
@@ -366,7 +366,7 @@ follows:
S: 32 bits, 0x67446698, magic (`NBD_SIMPLE_REPLY_MAGIC`; used to be
`NBD_REPLY_MAGIC`)
S: 32 bits, error (MAY be zero)
-S: 64 bits, handle
+S: 64 bits, cookie
S: (*length* bytes of data if the request is of type `NBD_CMD_READ` and
*error* is zero)
@@ -381,7 +381,7 @@ server must initiate a hard disconnect). Second, there is no way to
efficiently skip over port...
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
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.
2018 Dec 07
0
[nbdkit PATCH 6/5] nbd: More debug details
...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",
+ rep.handle, name_of_nbd_error(be32toh (rep.error)));
trans = find_trans_by_c...
2017 Nov 17
0
[nbdkit PATCH 3/6] connections: Add read/write lock over client I/O
...read_lock);
/* Perform the request. Only this part happens inside the request lock. */
if (quit) {
@@ -962,6 +981,7 @@ recv_request_send_reply (struct connection *conn)
/* Send the reply packet. */
send_reply:
+ pthread_mutex_lock (&conn->write_lock);
reply.magic = htobe32 (NBD_REPLY_MAGIC);
reply.handle = request.handle;
reply.error = htobe32 (nbd_errno (error));
@@ -978,6 +998,7 @@ recv_request_send_reply (struct connection *conn)
r = conn->send (conn, &reply, sizeof reply);
if (r == -1) {
nbdkit_error ("write reply: %m");
+ pthread_mutex_unlo...
2018 Dec 07
1
Re: [nbdkit PATCH 6/5] nbd: More debug details
...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",
> + rep.handle, name_of_nbd_error(be32toh (rep.error)));
>...
2018 Dec 06
0
[PATCH nbdkit 3/5] protocol: Generate map functions from NBD protocol flags to printable strings.
...e NBD_REP_ERR_PLATFORM 0x80000004
#define NBD_REP_ERR_TLS_REQD 0x80000005
+extern const char *name_of_nbd_info (int);
#define NBD_INFO_EXPORT 0
/* NBD_INFO_EXPORT reply (follows fixed_new_option_reply). */
@@ -148,6 +153,8 @@ struct reply {
#define NBD_REQUEST_MAGIC 0x25609513
#define NBD_REPLY_MAGIC 0x67446698
+/* NBD commands. */
+extern const char *name_of_nbd_cmd (int);
#define NBD_CMD_READ 0
#define NBD_CMD_WRITE 1
#define NBD_CMD_DISC 2 /* Disconnect. */
@@ -155,12 +162,14 @@ struct reply {
#define NBD_CMD_TRIM 4
#define NBD_CMD_...
2017 Nov 17
2
Re: [nbdkit PATCH 3/6] connections: Add read/write lock over client I/O
...est. Only this part happens inside the request lock. */
> if (quit) {
> @@ -962,6 +981,7 @@ recv_request_send_reply (struct connection *conn)
>
> /* Send the reply packet. */
> send_reply:
> + pthread_mutex_lock (&conn->write_lock);
> reply.magic = htobe32 (NBD_REPLY_MAGIC);
> reply.handle = request.handle;
> reply.error = htobe32 (nbd_errno (error));
> @@ -978,6 +998,7 @@ recv_request_send_reply (struct connection *conn)
> r = conn->send (conn, &reply, sizeof reply);
> if (r == -1) {
> nbdkit_error ("write reply: %m&q...
2017 Nov 17
8
[RFC nbdkit PATCH 0/6] Enable full parallel request handling
I want to make my nbd forwarding plugin fully parallel - but to do
that, I first need to make nbdkit itself fully parallel ;)
With this series, I was finally able to demonstrate out-of-order
responses when using qemu-io (which is great at sending back-to-back
requests prior to waiting for responses) coupled with the nbd file
plugin (which has a great feature of rdelay and wdelay, to make
it
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 Feb 20
1
Re: Fwd: nbdkit async
...code & ec) {
if (ec)
nbdkit_reply_error(op, ec.value());
else
nbdkit_reply(op);
});
return 0;
}
// connections.c
static int
_send_reply (struct operation *op, uint32_t count, void *buf, uint32_t
error)
{
int r;
struct reply reply;
reply.magic = htobe32 (NBD_REPLY_MAGIC);
reply.handle = op->handle;
reply.error = htobe32 (nbd_errno (error));
if (error != 0) {
/* Since we're about to send only the limited NBD_E* errno to the
* client, don't lose the information about what really happened
* on the server side. Make sure there is a w...
2017 Nov 20
10
[nbdkit PATCH v2 0/8] Support parallel transactions within single connection
I've posted some of these patches or ideas before; but now I'm
confident enough with the series that it should be ready to push;
at any rate, I can now run test-socket-activation in a tight loop
without triggering any crashes or hangs.
With this in place, I'm going back to work on making the nbd
forwarder wort with the parallel thread model.
Eric Blake (8):
sockets: Use
2017 Feb 19
2
Fwd: nbdkit async
----- Forwarded message -----
Date: Sat, 18 Feb 2017 22:21:19 -0500
Subject: nbdkit async
Hello,
Hope this is the right person to contact regarding nbdkit design.
I have a high latency massively parallel device that I am currently
implementing as an nbdkit plugin in c++ and have run into some design
limitations due to the synchronous callback interface nbdkit requires.
Nbdkit is currently
2017 Nov 14
0
[nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
..._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) != NBD_REPLY_MAGIC || rep.handle != trans->cookie)
+ return nbd_mark_dead (h);
+ switch (be32toh (rep.error)) {
+ case NBD_SUCCESS:
+ if (trans->buf && read_full (h->fd, trans->buf, trans->count) < 0)
+ return nbd_mark_dead (h);
+ return 0;
+ case NBD_EPERM:
+ return EP...
2017 Nov 12
6
[nbdkit PATCH] nbd: Add new nbd forwarding plugin
...;
+}
+
+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 ||
+ be64toh (rep.handle) != cookie) {
+ nbdkit_set_error (EIO);
+ h->dead = true;
+ return -1;
+ }
+ switch (be32toh (rep.error)) {
+ case NBD_SUCCESS:
+ return 0;
+ case NBD_EPERM:
+ nbdkit_set_error (EPERM);
+ return -1;
+ case NBD_EIO:
+ nbdkit_set_error (EIO...
2022 Nov 14
2
[PATCH v2 3/6] spec: Add NBD_OPT_EXTENDED_HEADERS
...only if the reply has no data payload. The message looks as
-follows:
+but only if the reply has no data payload. If extended headers have
+been negotiated, a simple reply MUST NOT be used. The message looks
+as follows:
S: 32 bits, 0x67446698, magic (`NBD_SIMPLE_REPLY_MAGIC`; used to be
`NBD_REPLY_MAGIC`)
S: 32 bits, error (MAY be zero)
-S: 64 bits, handle
+S: 64 bits, handle (MUST match the request)
S: (*length* bytes of data if the request is of type `NBD_CMD_READ` and
*error* is zero)
@@ -416,9 +473,9 @@ on the chunks received.
A structured reply chunk message looks as fol...