search for: abort_command

Displaying 20 results from an estimated 38 matches for "abort_command".

Did you mean: abort_commands
2019 Jul 18
3
[libnbd PATCH 0/2] in_flight improvements
Noticed while thinking about the recent threads wondering if we need a more efficient lookup from cookie back to command. Both of these fix bugs, but are tricky enough that I'm posting for review. Eric Blake (2): lib: Decrement in_flight at response, not retirement lib: Do O(1) rather than O(n) queue insertion generator/states-issue-command.c | 2 ++ generator/states-reply.c |
2019 Jun 29
0
[libnbd PATCH 4/6] states: Prepare for aio notify callback
...tates.c b/generator/states.c index deea73c..c9c3ef7 100644 --- a/generator/states.c +++ b/generator/states.c @@ -111,6 +111,31 @@ send_from_wbuf (struct nbd_handle *h) return 0; /* move to next state */ } +/* Forcefully fail any remaining in-flight commands in list */ +void abort_commands (struct nbd_handle *h, + struct command_in_flight **list) +{ + struct command_in_flight *prev_cmd, *cmd; + + for (cmd = *list, prev_cmd = NULL; + cmd != NULL; + prev_cmd = cmd, cmd = cmd->next) { + if (cmd->cb.notify && cmd->type != NBD_CMD_DIS...
2020 Sep 11
3
[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...diff --git a/lib/internal.h b/lib/internal.h index b2637bd..96699b5 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -435,6 +435,8 @@ extern int64_t nbd_internal_command_common (struct nbd_handle *h, struct socket *nbd_internal_socket_create (int fd); /* states.c */ +extern void nbd_internal_abort_commands (struct nbd_handle *h, + struct command **list); extern int nbd_internal_run (struct nbd_handle *h, enum external_event ev); extern const char *nbd_internal_state_short_string (enum state state); extern enum state_group nbd_internal_state_group (enum stat...
2020 Sep 17
0
Re: [libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...nal.h > index b2637bd..96699b5 100644 > --- a/lib/internal.h > +++ b/lib/internal.h > @@ -435,6 +435,8 @@ extern int64_t nbd_internal_command_common (struct nbd_handle *h, > struct socket *nbd_internal_socket_create (int fd); > > /* states.c */ > +extern void nbd_internal_abort_commands (struct nbd_handle *h, > + struct command **list); > extern int nbd_internal_run (struct nbd_handle *h, enum external_event ev); > extern const char *nbd_internal_state_short_string (enum state state); > extern enum state_group nbd_internal_st...
2019 Jul 18
1
Re: [libnbd PATCH 4/6] states: Prepare for aio notify callback
...se > commands to the completion queue. > > +++ b/generator/states.c > @@ -111,6 +111,31 @@ send_from_wbuf (struct nbd_handle *h) > return 0; /* move to next state */ > } > > +/* Forcefully fail any remaining in-flight commands in list */ > +void abort_commands (struct nbd_handle *h, > + struct command_in_flight **list) > +{ > + struct command_in_flight *prev_cmd, *cmd; > + > + for (cmd = *list, prev_cmd = NULL; > + cmd != NULL; > + prev_cmd = cmd, cmd = cmd->next) { > + if (cmd->cb.notif...
2020 Aug 14
0
[libnbd PATCH v2 11/13] api: Add nbd_aio_opt_list
...orcefully fail any in-flight option */ +static void +abort_option (struct nbd_handle *h) +{ + int err = nbd_get_errno () ? : ENOTCONN; + + CALL_CALLBACK (h->opt_cb.completion, &err); + nbd_internal_free_option (h); +} + /* Forcefully fail any remaining in-flight commands in list */ -void abort_commands (struct nbd_handle *h, - struct command **list) +static void +abort_commands (struct nbd_handle *h, struct command **list) { struct command *next, *cmd; @@ -168,6 +178,7 @@ STATE_MACHINE { DEAD: /* The caller should have used set_error() before reaching here */ ass...
2020 Aug 18
0
[libnbd PATCH v3 2/2] api: Add nbd_aio_opt_list
...orcefully fail any in-flight option */ +static void +abort_option (struct nbd_handle *h) +{ + int err = nbd_get_errno () ? : ENOTCONN; + + CALL_CALLBACK (h->opt_cb.completion, &err); + nbd_internal_free_option (h); +} + /* Forcefully fail any remaining in-flight commands in list */ -void abort_commands (struct nbd_handle *h, - struct command **list) +static void +abort_commands (struct nbd_handle *h, struct command **list) { struct command *next, *cmd; @@ -168,6 +178,7 @@ STATE_MACHINE { DEAD: /* The caller should have used set_error() before reaching here */ ass...
2019 Aug 12
0
[PATCH libnbd 2/7] lib: Allow retired commands to use free_callback on their buffer.
...nd_free_command (h, cmd); else { if (h->cmds_done_tail != NULL) h->cmds_done_tail = h->cmds_done_tail->next = cmd; diff --git a/generator/states.c b/generator/states.c index 9ed57ae..a11c1d1 100644 --- a/generator/states.c +++ b/generator/states.c @@ -142,7 +142,7 @@ void abort_commands (struct nbd_handle *h, if (cmd->error == 0) cmd->error = ENOTCONN; if (retire) - nbd_internal_retire_and_free_command (cmd); + nbd_internal_retire_and_free_command (h, cmd); else { cmd->next = NULL; if (h->cmds_done_tail) diff --git a/lib/a...
2019 Aug 14
2
[libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...L_CALLBACK (cmd->cb.completion, &error); - FREE_CALLBACK (cmd->cb.completion); switch (r) { case -1: if (error) diff --git a/generator/states.c b/generator/states.c index 263f60e..cfa9957 100644 --- a/generator/states.c +++ b/generator/states.c @@ -127,7 +127,6 @@ void abort_commands (struct nbd_handle *h, assert (cmd->type != NBD_CMD_DISC); r = CALL_CALLBACK (cmd->cb.completion, &error); - FREE_CALLBACK (cmd->cb.completion); switch (r) { case -1: if (error) diff --git a/lib/aio.c b/lib/aio.c index 38a27d0..4a219e4 100644...
2019 Aug 13
0
[PATCH libnbd 4/4] lib: Add CALL_CALLBACK macro.
...ror); + r = CALL_CALLBACK (cmd->cb.completion, &error); FREE_CALLBACK (cmd->cb.completion); switch (r) { case -1: diff --git a/generator/states.c b/generator/states.c index 98c10b3..263f60e 100644 --- a/generator/states.c +++ b/generator/states.c @@ -126,7 +126,7 @@ void abort_commands (struct nbd_handle *h, int r; assert (cmd->type != NBD_CMD_DISC); - r = cmd->cb.completion.callback (cmd->cb.completion.user_data, &error); + r = CALL_CALLBACK (cmd->cb.completion, &error); FREE_CALLBACK (cmd->cb.completion); switch (r...
2019 Aug 12
0
[PATCH libnbd 4/7] lib: Allow closure user_data to be associated with a free callback.
..._free_callback (h, cmd->cb.user_data); cmd->cb.completion = NULL; /* because we've freed it */ switch (r) { case -1: diff --git a/generator/states.c b/generator/states.c index a11c1d1..313d2c9 100644 --- a/generator/states.c +++ b/generator/states.c @@ -128,6 +128,7 @@ void abort_commands (struct nbd_handle *h, assert (cmd->type != NBD_CMD_DISC); r = cmd->cb.completion (LIBNBD_CALLBACK_VALID|LIBNBD_CALLBACK_FREE, cmd->cb.user_data, &error); + nbd_internal_free_callback (h, cmd->cb.user_data); cmd->cb.comple...
2019 Aug 15
0
[PATCH libnbd v2 02/10] lib: Add macros to check if a callback is "null" or not, and set it to null.
...- if (cmd->cb.completion.callback) { + if (CALLBACK_IS_NOT_NULL (cmd->cb.completion)) { int error = cmd->error; int r; diff --git a/generator/states.c b/generator/states.c index cfa9957..32bf975 100644 --- a/generator/states.c +++ b/generator/states.c @@ -121,7 +121,7 @@ void abort_commands (struct nbd_handle *h, bool retire = cmd->type == NBD_CMD_DISC; next = cmd->next; - if (cmd->cb.completion.callback) { + if (CALLBACK_IS_NOT_NULL (cmd->cb.completion)) { int error = cmd->error ? cmd->error : ENOTCONN; int r; diff --git a/lib/debu...
2019 Jul 18
0
[libnbd PATCH 2/2] lib: Do O(1) rather than O(n) queue insertion
...cmds_done = h->cmds_done_tail = cmd; } - else - h->cmds_done = cmd; h->in_flight--; assert (h->in_flight >= 0); diff --git a/generator/states.c b/generator/states.c index bc2b4a6..69aa431 100644 --- a/generator/states.c +++ b/generator/states.c @@ -132,8 +132,13 @@ void abort_commands (struct nbd_handle *h, cmd->error = ENOTCONN; } if (prev_cmd) { - prev_cmd->next = h->cmds_done; - h->cmds_done = *list; + if (h->cmds_done_tail) + h->cmds_done_tail->next = *list; + else { + assert (h->cmds_done == NULL); + h->cmd...
2019 Aug 13
0
[PATCH libnbd 3/4] lib: Add FREE_CALLBACK macro.
...llback = NULL; /* because we've freed it */ + FREE_CALLBACK (cmd->cb.completion); switch (r) { case -1: if (error) diff --git a/generator/states.c b/generator/states.c index 444a082..98c10b3 100644 --- a/generator/states.c +++ b/generator/states.c @@ -127,9 +127,7 @@ void abort_commands (struct nbd_handle *h, assert (cmd->type != NBD_CMD_DISC); r = cmd->cb.completion.callback (cmd->cb.completion.user_data, &error); - if (cmd->cb.completion.free) - cmd->cb.completion.free (cmd->cb.completion.user_data); - cmd->cb.completion...
2019 Aug 15
0
Re: [libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...); > - FREE_CALLBACK (cmd->cb.completion); > switch (r) { > case -1: > if (error) > diff --git a/generator/states.c b/generator/states.c > index 263f60e..cfa9957 100644 > --- a/generator/states.c > +++ b/generator/states.c > @@ -127,7 +127,6 @@ void abort_commands (struct nbd_handle *h, > > assert (cmd->type != NBD_CMD_DISC); > r = CALL_CALLBACK (cmd->cb.completion, &error); > - FREE_CALLBACK (cmd->cb.completion); > switch (r) { > case -1: > if (error) > diff --git a/lib/aio.c b...
2020 Aug 18
3
[libnbd PATCH v3 0/2] Implementing NBD_OPT_LIST
This is a subset of my v2 posting, but limited to just the NBD_OPT_LIST handling. The biggest change since v2 is the addition of added unit testing in all four language bindings (C, python, ocaml, golang). The tests require nbdkit built from git on PATH, and may not be entirely idiomatic, but I at least validated that they catch issues (for example, adding an exit statement near the end of the
2019 Jun 29
19
[libnbd PATCH 0/6] new APIs: aio_in_flight, aio_FOO_notify
I still need to wire in the use of *_notify functions into nbdkit to prove whether it makes the code any faster or easier to maintain, but at least the added example shows one good use case for the new API. Eric Blake (6): api: Add nbd_aio_in_flight generator: Allow DEAD state actions to run generator: Allow Int64 in callbacks states: Prepare for aio notify callback api: Add new
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...espin my proposal to let the callback return 1 to auto-retire). > cmd->error = error; > } > > diff --git a/generator/states.c b/generator/states.c > index 69aa431..374b8c5 100644 > --- a/generator/states.c > +++ b/generator/states.c > @@ -124,7 +124,8 @@ void abort_commands (struct nbd_handle *h, > int error = cmd->error ? cmd->error : ENOTCONN; > > assert (cmd->type != NBD_CMD_DISC); > - if (cmd->cb.callback (cmd->cb.user_data, cmd->cookie, > + if (cmd->cb.callback (LIBNBD_CALLBACK_VALID, > +...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
..._and_free_command (cmd); else { if (h->cmds_done_tail != NULL) h->cmds_done_tail = h->cmds_done_tail->next = cmd; diff --git a/generator/states.c b/generator/states.c index 2d7e197..a7f7ca0 100644 --- a/generator/states.c +++ b/generator/states.c @@ -123,9 +123,13 @@ void abort_commands (struct nbd_handle *h, next = cmd->next; if (cmd->cb.callback) { int error = cmd->error ? cmd->error : ENOTCONN; + int r; assert (cmd->type != NBD_CMD_DISC); - switch (cmd->cb.callback (cmd->cb.user_data, cmd->cookie, &error)) { +...
2019 Jul 30
3
[PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...cmd->cb.user_data, &error); cmd->cb.callback = NULL; /* because we've freed it */ switch (r) { case -1: diff --git a/generator/states.c b/generator/states.c index a7f7ca0..654e4c8 100644 --- a/generator/states.c +++ b/generator/states.c @@ -127,7 +127,7 @@ void abort_commands (struct nbd_handle *h, assert (cmd->type != NBD_CMD_DISC); r = cmd->cb.callback (LIBNBD_CALLBACK_VALID|LIBNBD_CALLBACK_FREE, - cmd->cb.user_data, cmd->cookie, &error); + cmd->cb.user_data, &error);...