Displaying 14 results from an estimated 14 matches for "nbd_unlocked_aio_is_dead".
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 Jun 05
0
[PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...d_unlocked_aio_is_ready (h))
+ if (nbd_internal_is_state_ready (h->state))
return 0;
/* Why did it fail? */
- if (nbd_unlocked_aio_is_closed (h)) {
+ if (nbd_internal_is_state_closed (h->state)) {
set_error (0, "connection is closed");
return -1;
}
- if (nbd_unlocked_aio_is_dead (h))
+ if (nbd_internal_is_state_dead (h->state))
/* Don't set the error here, keep the error set when
* the connection died.
*/
@@ -62,7 +62,7 @@ error_unless_ready (struct nbd_handle *h)
static int
wait_until_connected (struct nbd_handle *h)
{
- while (nbd_unlocked_ai...
2019 May 21
0
[PATCH libnbd] api: Synchronous connect waits til all connections are connected.
...nected? */
for (i = 0; i < h->multi_conn; ++i) {
- if (nbd_unlocked_aio_is_ready (h->conns[i])) {
- connected = true;
+ if (nbd_unlocked_aio_is_closed (h->conns[i])) {
+ set_error (0, "connection is closed");
+ return -1;
+ }
+ if (nbd_unlocked_aio_is_dead (h->conns[i])) {
+ /* Don't set the error here, keep the error set when
+ * the connection died.
+ */
+ return -1;
+ }
+ if (!nbd_unlocked_aio_is_ready (h->conns[i])) {
+ all_connected = false;
break;
}
}
- if (conne...
2019 May 22
0
[PATCH libnbd v2 1/6] api: Synchronous connect waits til all connections are connected.
...nected? */
for (i = 0; i < h->multi_conn; ++i) {
- if (nbd_unlocked_aio_is_ready (h->conns[i])) {
- connected = true;
+ if (nbd_unlocked_aio_is_closed (h->conns[i])) {
+ set_error (0, "connection is closed");
+ return -1;
+ }
+ if (nbd_unlocked_aio_is_dead (h->conns[i])) {
+ /* Don't set the error here, keep the error set when
+ * the connection died.
+ */
+ return -1;
+ }
+ if (!nbd_unlocked_aio_is_ready (h->conns[i])) {
+ all_connected = false;
break;
}
}
- if (conne...
2019 Jun 05
0
[PATCH libnbd 1/4] lib: Move nbd_aio_is_* function impls to separate source file.
...- }
-}
-
-/* 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: is_locked = false, may_set_error = false. */
-int
-nbd_unlocked_aio_is_closed (struct nbd_handle *h)
-{
- return h->state == STATE_CLOSED;
-}
-
int
nbd_unlocked_aio_command_completed (struct nbd_handle *h,...
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 May 21
2
[PATCH libnbd] api: Synchronous connect waits til all connections are connected.
nbd_connect_unix|tcp had a tricky failure case. This is a consequence
of allowing callers to mix synchronous and asynchronous calls, with
multi-conn thrown into the mix.
I think the new behaviour proposed here is better. We could do with a
better way of classifying the state of connections, such as are they
connectING.
Rich.
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 Jun 05
1
Re: [PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...s_state_ready (h->state))
> return 0;
>
> /* Why did it fail? */
> - if (nbd_unlocked_aio_is_closed (h)) {
> + if (nbd_internal_is_state_closed (h->state)) {
> set_error (0, "connection is closed");
> return -1;
> }
>
> - if (nbd_unlocked_aio_is_dead (h))
> + if (nbd_internal_is_state_dead (h->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...
2019 Jun 05
0
[PATCH libnbd 3/4] lib: Add set_state / get_state macros.
.../* 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->state);
+ return nbd_internal_is_state_dead (get_state (h));
}
/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_closed (struct nbd_handle *h)
{
- return nbd_internal_is_state_closed (h->stat...
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.
...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_dead (get_state (h));
+ return nbd_internal_is_state_dead (get_public_state (h));
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_closed (struct nbd_handle *h)
{
- return nbd_internal_is_state_closed (g...
2019 Jun 05
1
[PATCH libnbd v2] lib: Atomically update h->state when leaving the locked region.
...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_dead (get_state (h));
+ return nbd_internal_is_state_dead (get_public_state (h));
}
-/* NB: is_locked = false, may_set_error = false. */
int
nbd_unlocked_aio_is_closed (struct nbd_handle *h)
{
- return nbd_internal_is_state_closed (g...
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