Displaying 17 results from an estimated 17 matches for "nbd_unlocked_aio_is_processing".
2019 Jun 05
0
[PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...unlocked_poll (h, -1) == -1)
return -1;
}
diff --git a/lib/disconnect.c b/lib/disconnect.c
index 6695e59..355a1c9 100644
--- a/lib/disconnect.c
+++ b/lib/disconnect.c
@@ -29,15 +29,14 @@
int
nbd_unlocked_shutdown (struct nbd_handle *h)
{
-
- if (nbd_unlocked_aio_is_ready (h) ||
- nbd_unlocked_aio_is_processing (h)) {
+ if (nbd_internal_is_state_ready (h->state) ||
+ nbd_internal_is_state_processing (h->state)) {
if (nbd_unlocked_aio_disconnect (h, 0) == -1)
return -1;
}
- while (!nbd_unlocked_aio_is_closed (h) &&
- !nbd_unlocked_aio_is_dead (h)) {
+ while (!...
2019 May 30
3
[PATCH libnbd 0/2] Avoid lock and error overhead on some calls.
This works. I'm in the middle of testing whether there is any
noticable benefit.
Rich.
2019 May 22
0
[libnbd PATCH v3 2/7] commands: Allow for a command queue
...bd_connection *conn,
uint64_t offset, uint64_t count, void *data,
int64_t id, extent_fn extent)
{
- struct command_in_flight *cmd;
+ struct command_in_flight *cmd, *prev_cmd;
+
+ if (!nbd_unlocked_aio_is_ready (conn) &&
+ !nbd_unlocked_aio_is_processing (conn)) {
+ set_error (0, "command request %s is invalid in state %s",
+ nbd_internal_name_of_nbd_cmd (type),
+ nbd_internal_state_short_string (conn->state));
+ return -1;
+ }
switch (type) {
/* Commands which send or receive data are limite...
2019 Jun 05
9
[PATCH libnbd 0/4] lib: Atomically update h->state.
I need to think about this patch series a bit more, but it
does at least pass the tests.
Rich.
2019 Jun 05
0
[PATCH libnbd 1/4] lib: Move nbd_aio_is_* function impls to separate source file.
...um state_group group)
-{
- switch (group) {
- case GROUP_TOP:
- return 0;
- case GROUP_ISSUE_COMMAND:
- case GROUP_REPLY:
- return 1;
- default:
- return is_processing_group (nbd_internal_state_group_parent (group));
- }
-}
-
-/* NB: is_locked = false, may_set_error = false. */
-int
-nbd_unlocked_aio_is_processing (struct nbd_handle *h)
-{
- enum state_group group = nbd_internal_state_group (h->state);
-
- return is_processing_group (group);
-}
-
-/* NB: is_locked = false, may_set_error = false. */
-int
-nbd_unlocked_aio_is_dead (struct nbd_handle *h)
-{
- return h->state == STATE_DEAD;
-}
-
-/* NB:...
2019 May 22
1
Re: [libnbd PATCH v2 2/5] commands: Allow for a command queue
...y will let you get rid of the reached_ready flag, as well
as making this patch more correct because you probably want to avoid
issuing commands on a connection which is closed or dead.
You'd use a test like:
if (nbd_unlocked_aio_is_ready (conn)) {
// call nbd_internal_run
}
else if (nbd_unlocked_aio_is_processing (conn)) {
// can't call nbd_internal_run because we're in the
// wrong state, but we can enqueue the command and it
// will be processed next time we get to READY
}
else {
// this is an error
}
> @@ -296,9 +297,24 @@ command_common (struct nbd_connection *conn,
>...
2019 May 22
0
[libnbd PATCH v3 4/7] disconnect: Allow shutdown during processing
...ea0 100644
--- a/lib/disconnect.c
+++ b/lib/disconnect.c
@@ -31,7 +31,8 @@ nbd_unlocked_shutdown (struct nbd_handle *h)
size_t i;
for (i = 0; i < h->multi_conn; ++i) {
- if (nbd_unlocked_aio_is_ready (h->conns[i])) {
+ if (nbd_unlocked_aio_is_ready (h->conns[i]) ||
+ nbd_unlocked_aio_is_processing (h->conns[i])) {
if (nbd_unlocked_aio_disconnect (h->conns[i]) == -1)
return -1;
}
--
2.20.1
2019 May 22
12
[libnbd PATCH v3 0/7] Avoid deadlock with in-flight commands
Since v2:
- rebase to Rich's new API calls
- more refactoring in patch 1 (retitled)
- new patches 3 and 4
- fix data corruption in patch 6 (was 4)
- more tweaks to the reproducer example (including using new API from 3)
Eric Blake (7):
lib: Refactor command_common() to do more common work
commands: Allow for a command queue
commands: Expose FIFO ordering of server completions
2019 Jun 05
1
Re: [PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...->state))
error_unless_ready() is called while lock is held, so multiple reads of
h->state are fine here.
> +++ b/lib/disconnect.c
> @@ -29,15 +29,14 @@
> int
> nbd_unlocked_shutdown (struct nbd_handle *h)
> {
> -
> - if (nbd_unlocked_aio_is_ready (h) ||
> - nbd_unlocked_aio_is_processing (h)) {
> + if (nbd_internal_is_state_ready (h->state) ||
> + nbd_internal_is_state_processing (h->state)) {
Likewise safe for multiple h->state reads.
> +/* NB: is_locked = false, may_set_error = false. */
> +int
> +nbd_unlocked_aio_is_created (struct nbd_handle *h)...
2019 Jun 05
0
[PATCH libnbd 3/4] lib: Add set_state / get_state macros.
...state (h));
}
/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_ready (struct nbd_handle *h)
{
- return nbd_internal_is_state_ready (h->state);
+ return nbd_internal_is_state_ready (get_state (h));
}
/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_processing (struct nbd_handle *h)
{
- return nbd_internal_is_state_processing (h->state);
+ return nbd_internal_is_state_processing (get_state (h));
}
/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_dead (struct nbd_handle *h)
{
- return nbd_internal_is_state_dead (h-...
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 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
...);
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_ready (struct nbd_handle *h)
{
- return nbd_internal_is_state_ready (get_state (h));
+ return nbd_internal_is_state_ready (get_public_state (h));
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_processing (struct nbd_handle *h)
{
- return nbd_internal_is_state_processing (get_state (h));
+ return nbd_internal_is_state_processing (get_public_state (h));
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_dead (struct nbd_handle *h)
{
- return nbd_internal_is_state...
2019 Jun 05
1
[PATCH libnbd v2] lib: Atomically update h->state when leaving the locked region.
...);
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_ready (struct nbd_handle *h)
{
- return nbd_internal_is_state_ready (get_state (h));
+ return nbd_internal_is_state_ready (get_public_state (h));
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_processing (struct nbd_handle *h)
{
- return nbd_internal_is_state_processing (get_state (h));
+ return nbd_internal_is_state_processing (get_public_state (h));
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_dead (struct nbd_handle *h)
{
- return nbd_internal_is_state...
2019 Jun 08
4
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00055
v2 was here:
https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00067
v3:
- Fix atomicly -> atomically in commit message.
- Fix a comment.
- Fix TOCTTOU: There is now an inline function generated called
<name>_is_permitted_state, and this is called twice, first outside
the
2019 May 22
8
[PATCH libnbd v2 0/6] Test connection states.
Patch 1/6 was posted before and I didn't change it:
https://www.redhat.com/archives/libguestfs/2019-May/thread.html#00134
That doesn't necessarily mean I shouldn't change it, I'm posting
it again because the other patches depend on it.
The main change in this series is we add three new API functions:
nbd_aio_is_created - connection has just been created
2019 May 22
10
[libnbd PATCH v2 0/5] Avoid deadlock with in-flight commands
On v1, we discussed whether cmds_to_issue needed to be a list, since
it never had more than one element. I played with the idea of making
it a list, and allowing the client to queue up new commands regardless
of whether the state machine is currently in READY. I also polished up
the tmp demo into a bit more full-fledged example file, worth
including since it also let me discover a hard-to-hit race
2019 May 28
6
[RFC libnbd PATCH 0/4] Add CMD_FLAG_DF support
RFC because this is an API break, but we haven't declared stable API
yet. If we like it, I'm working on using libnbd to implement the
nbdkit-nbd plugin; knowing whether it is API version 0.1 or 0.2 will
be useful. I also dabbled with allowing optional parameters in python,
although my OCaml is weak enough that there may be cleaner ways to
approach that.
Eric Blake (4):
api: Add flags