search for: meta_context

Displaying 20 results from an estimated 67 matches for "meta_context".

2019 Jun 04
0
[libnbd PATCH 2/2] api: Recover from block status callback failure
...| 65 +++++++++++++++++++++++------ 3 files changed, 86 insertions(+), 41 deletions(-) diff --git a/generator/generator b/generator/generator index 91545ce..1261d54 100755 --- a/generator/generator +++ b/generator/generator @@ -1414,7 +1414,10 @@ supported by the server (see C<nbd_can_meta_context>) this call returns information about extents by calling back to the extent function. The callback cannot call C<nbd_*> APIs on the same handle since it holds the handle lock and will -cause a deadlock. +cause a deadlock. If the callback returns C<-1>, any remaining +contexts wi...
2019 Jun 27
1
[libnbd PATCH] block-status: Make callback usage consistent with pread_structured
..."nr_entries"); + Mutable (Int "error")]); Flags "flags" ]; ret = RErr; permitted_states = [ Connected ]; @@ -1548,10 +1549,11 @@ supported by the server (see C<nbd_can_meta_context>) this call returns information about extents by calling back to the C<extent> function. The callback cannot call C<nbd_*> APIs on the same handle since it holds the handle lock and will -cause a deadlock. If the callback returns C<-1>, any remaining -contexts will be igno...
2019 Jun 04
3
[libnbd PATCH 0/2] Better handling of failed block_status callback
Rather than moving the connection to DEAD, we can just ignore further contexts to the existing command handle, and fail the overall command with the same errno as the failed callback. Eric Blake (2): states: Track cmd->error as errno, not wire value api: Recover from block status callback failure generator/generator | 5 ++- generator/states-reply-simple.c | 2 +-
2020 Sep 28
0
[libnbd PATCH 3/3] api: Add nbd_opt_list_meta_context
...c"; see_also = [Link "get_opt_mode"; Link "aio_is_negotiating"; Link "opt_abort"; Link "opt_go"; Link "opt_list"; - Link "opt_info"]; + Link "opt_info"; Link "opt_list_meta_context"]; }; "get_opt_mode", { @@ -960,6 +965,56 @@ corresponding L<nbd_opt_go(3)> would succeed."; Link "set_export_name"]; }; + "opt_list_meta_context", { + default_call with + args = [ Closure context_closure ]; ret = RInt...
2020 Sep 28
8
[libnbd PATCH 0/3] opt_list_meta_context
...do: - write interop tests for qemu-nbd and nbdkit (including my proposed patch addition of qemu-nbd -A to show qemu:allocation-depth) - figure out if we can make 'nbdinfo --map' use the new API to automatically select all contexts advertised by the server Eric Blake (3): api: Add get_nr_meta_contexts, clear_meta_contexts generator: Rename OPT_SET_META_CONTEXT states api: Add nbd_opt_list_meta_context lib/internal.h | 1 + generator/API.ml | 162 +++++++++++++++++- generator/Makefile.am | 4 +- generat...
2019 Jun 04
1
Re: [PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...le place or formalize what exception.\n"; Spurious trailing '.' > + pr " * means error versus unexpected failure.\n"; > + pr " */\n"; > +++ b/generator/states-reply-structured.c > @@ -369,10 +369,16 @@ > if (context_id == meta_context->context_id) > break; > > - if (meta_context) > + if (meta_context) { > /* Call the caller's extent function. */ > - cmd->extent_fn (cmd->data, meta_context->name, cmd->offset, > - &h->bs_entries[1], (l...
2023 Aug 04
2
[libnbd PATCH v4 01/25] block_status: Add some sanity checking of server lengths
...const char *name; > + uint32_t orig_len, len, flags; > + uint64_t total, cap; > + bool stop; > > switch (recv_into_rbuf (h)) { > case -1: SET_NEXT_STATE (%.DEAD); return 0; > @@ -481,30 +486,63 @@ REPLY.CHUNK_REPLY.RECV_BS_ENTRIES: > if (context_id == h->meta_contexts.ptr[i].context_id) > break; > > - if (i < h->meta_contexts.len) { > - int error = cmd->error; > - const char *name = h->meta_contexts.ptr[i].name; > - > - /* Need to byte-swap the entries returned, but apart from that > - * we d...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples have been updated, but it demonstrates an idea: Should we forget about the concept of having multiple connections managed under a single handle? In this patch there is a single ‘struct nbd_handle *’ which manages a single state machine and connection (and therefore no nbd_connection). To connect to a multi-conn server you must
2019 Jul 25
0
[PATCH libnbd v3 2/2] lib: Remove nbd_add_close_callback.
...ser_data); - "; pr "=head1 API CALLS\n"; diff --git a/lib/handle.c b/lib/handle.c index 6f5a4d6..840702a 100644 --- a/lib/handle.c +++ b/lib/handle.c @@ -90,7 +90,6 @@ nbd_create (void) void nbd_close (struct nbd_handle *h) { - struct close_callback *cc, *cc_next; struct meta_context *m, *m_next; if (h == NULL) @@ -100,12 +99,6 @@ nbd_close (struct nbd_handle *h) if (h->debug_fn) h->debug_fn (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL); - for (cc = h->close_callbacks; cc != NULL; cc = cc_next) { - cc_next = cc->next; - cc->cb (cc-&gt...
2020 Oct 02
4
[libnbd PATCH v2 0/2] opt_list_meta_context
In v2: ack'ed preliminary patches have been pushed, and I've added a lot of testsuite coverage as well as putting the new API to use in nbdinfo. Eric Blake (2): api: Add nbd_opt_list_meta_context info: List available meta-contexts lib/internal.h | 1 + generator/API.ml | 84 ++++++++- generator/states-newstyle-opt-meta-context.c | 83 +++++++-- generator/states-newstyle.c | 3 + lib/opt.c...
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
...n_cache() - # Not yet implemented: can_extents. + # In theory we could use a test like this, but nbdkit can + # always synthesize base:allocation block_status responses + # even if the plugin doesn't support them. + # + #def test_can_extents_true (self): + # self.h.add_meta_context ("base:allocation") + # self.connect ({"size": 512, "can_extents": True}) + # assert self.h.can_meta_context ("base:allocation") + # + #def test_can_extents_false (self): + # self.h.add_meta_context ("base:allocation") + #...
2019 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...pr "}\n" | _ -> () ) args; diff --git a/generator/states-reply-structured.c b/generator/states-reply-structured.c index e6c1a8a..c835713 100644 --- a/generator/states-reply-structured.c +++ b/generator/states-reply-structured.c @@ -369,10 +369,16 @@ if (context_id == meta_context->context_id) break; - if (meta_context) + if (meta_context) { /* Call the caller's extent function. */ - cmd->extent_fn (cmd->data, meta_context->name, cmd->offset, - &h->bs_entries[1], (length-4) / 4); + if (cmd->e...
2019 Jun 14
0
[libnbd PATCH 5/7] states: Factor out NBD_REP payload prep
...it a/generator/states-newstyle-opt-set-meta-context.c b/generator/states-newstyle-opt-set-meta-context.c index feaa295..94120e2 100644 --- a/generator/states-newstyle-opt-set-meta-context.c +++ b/generator/states-newstyle-opt-set-meta-context.c @@ -139,21 +139,13 @@ return 0; NEWSTYLE.OPT_SET_META_CONTEXT.RECV_REPLY: - uint32_t len; - const uint32_t maxpayload = sizeof h->sbuf.or.payload.context; - switch (recv_into_rbuf (h)) { case -1: SET_NEXT_STATE (%.DEAD); return -1; case 0: - /* Read the following payload if it is short enough to fit in the - * static buffer. If it's...
2019 Jun 18
0
[libnbd PATCH 4/8] states: Prepare for read callback
...rn -1; @@ -375,7 +375,7 @@ length = be32toh (h->sbuf.sr.structured_reply.length); assert (cmd); /* guaranteed by CHECK */ - assert (cmd->extent_fn); + assert (cmd->cb.fn.extent); assert (h->bs_entries); assert (length >= 12); @@ -401,8 +401,8 @@ if (meta_context) { /* Call the caller's extent function. */ errno = 0; - if (cmd->extent_fn (cmd->data, meta_context->name, cmd->offset, - &h->bs_entries[1], (length-4) / 4) == -1) + if (cmd->cb.fn.extent (cmd->cb.opaque, meta_...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...lemented: can_extents. > + # In theory we could use a test like this, but nbdkit can > + # always synthesize base:allocation block_status responses > + # even if the plugin doesn't support them. > + # > + #def test_can_extents_true (self): > + # self.h.add_meta_context ("base:allocation") > + # self.connect ({"size": 512, "can_extents": True}) > + # assert self.h.can_meta_context ("base:allocation") > + # > + #def test_can_extents_false (self): > + # self.h.add_meta_context ("base...
2019 Jun 14
10
[libnbd PATCH 0/7] state machine refactoring
...if we should instead keep it small and add one more indirection where sbuf is malloc'd; I'm not sure that it matters much (outside of libnbd, nbd_handle is an opaque type always referenced as a pointer). Eric Blake (7): states: Log structured error messages, if any states: Refactor SET_META_CONTEXT reply parsing states: Allow large SET_CONTEXT_NAME replies states: Rewrite NBD_REP_INFO parsing states: Factor out NBD_REP payload prep states: Give up on oversized reply length states: Capture NBD_REP_ERR message generator/generator | 19 ++-- generator/states...
2019 Jun 29
0
[libnbd PATCH 2/6] generator: Allow DEAD state actions to run
...CHINE */ diff --git a/generator/states-newstyle-opt-set-meta-context.c b/generator/states-newstyle-opt-set-meta-context.c index a00a411..7904fe7 100644 --- a/generator/states-newstyle-opt-set-meta-context.c +++ b/generator/states-newstyle-opt-set-meta-context.c @@ -53,7 +53,7 @@ NEWSTYLE.OPT_SET_META_CONTEXT.SEND: switch (send_from_wbuf (h)) { - case -1: SET_NEXT_STATE (%.DEAD); return -1; + case -1: SET_NEXT_STATE (%.DEAD); return 0; case 0: h->sbuf.len = htobe32 (strlen (h->export_name)); h->wbuf = &h->sbuf.len; @@ -65,7 +65,7 @@ NEWSTYLE.OPT_SET_META_CONTEXT.SEND...
2019 Jul 25
0
[libnbd PATCH] lib: Reduce number of read/block_status callbacks
...BD_READ_HOLE, &error) == -1) if (cmd->error == 0) cmd->error = error ? error : EPROTO; + if (valid & LIBNBD_CALLBACK_FREE) + cmd->cb.fn.read = NULL; /* because we've freed it */ } SET_NEXT_STATE(%FINISH); @@ -498,12 +520,15 @@ if (meta_context) { /* Call the caller's extent function. */ int error = cmd->error; + unsigned valid = valid_flags (h); - if (cmd->cb.fn.extent (LIBNBD_CALLBACK_VALID, cmd->cb.fn_user_data, + if (cmd->cb.fn.extent (valid, cmd->cb.fn_user_data,...
2019 Aug 12
0
[PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
...!= 0) + abort (); + free (h->free_callbacks); + nbd_internal_free_string_list (h->argv); free (h->unixsocket); free (h->hostname); diff --git a/lib/internal.h b/lib/internal.h index 301b798..d8b0eed 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -47,6 +47,7 @@ struct meta_context; struct socket; struct command; +struct free_callback; struct nbd_handle { /* Unique name assigned to this handle for debug messages @@ -87,6 +88,10 @@ struct nbd_handle { nbd_debug_callback debug_callback; void *debug_data; + /* Free callbacks kept in pointer order. */ + struct f...
2019 Aug 14
2
[libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...LIBNBD_READ_HOLE, &error) == -1) if (cmd->error == 0) cmd->error = error ? error : EPROTO; - if (flags & NBD_REPLY_FLAG_DONE) - FREE_CALLBACK (cmd->cb.fn.chunk); } SET_NEXT_STATE(%FINISH); @@ -509,7 +500,6 @@ if (meta_context) { /* Call the caller's extent function. */ int error = cmd->error; - uint16_t flags = be16toh (h->sbuf.sr.structured_reply.flags); if (CALL_CALLBACK (cmd->cb.fn.extent, meta_context->name, cmd->offset, @@ -517,8 +507,6 @@...