Displaying 15 results from an estimated 15 matches for "nbd_unlocked_aio_is_closed".
2019 Jun 05
0
[PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...lib/connect.c
index 50ec58a..63d2234 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -38,16 +38,16 @@
static int
error_unless_ready (struct nbd_handle *h)
{
- if (nbd_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 co...
2019 May 21
0
[PATCH libnbd] api: Synchronous connect waits til all connections are connected.
...ize_t i;
for (;;) {
- bool connected = false;
+ bool all_connected = true;
- /* Are any connected? */
+ /* Are any not yet connected? */
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;
+...
2019 May 22
0
[PATCH libnbd v2 1/6] api: Synchronous connect waits til all connections are connected.
...ize_t i;
for (;;) {
- bool connected = false;
+ bool all_connected = true;
- /* Are any connected? */
+ /* Are any not yet connected? */
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;
+...
2019 Jun 05
0
[PATCH libnbd 1/4] lib: Move nbd_aio_is_* function impls to separate source file.
...= 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,
int64_t handle)
diff --git a/lib/is-state.c b/lib/is-state.c
new file mode 100644
index 0000000..5ed2ee9
--- /dev/null
+++ b/lib...
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
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.
...spots.
> +++ b/lib/connect.c
> @@ -38,16 +38,16 @@
> static int
> error_unless_ready (struct nbd_handle *h)
> {
> - if (nbd_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))
error_unless_ready() is called while loc...
2019 Jun 05
0
[PATCH libnbd 3/4] lib: Add set_state / get_state macros.
...et_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->state);
+ return nbd_internal_is_state_closed (get_state (h));
}
diff --git a/lib/rw.c b/lib/rw.c
index 5fe3c64..b38d95b 100644
--- a/lib/rw.c
+++ b/lib/rw.c
@@ -201,7 +201,7 @@ nbd_internal_command_common (struct nbd_handle...
2019 Jul 25
2
[libnbd PATCH] generator: Let nbd_aio_get_direction return unsigned
...n"
| RInt64 -> pr " rv = caml_copy_int64 (r);\n"
| RConstString -> pr " rv = caml_copy_string (r);\n"
| RString ->
diff --git a/lib/is-state.c b/lib/is-state.c
index d3335fb..1a85c7a 100644
--- a/lib/is-state.c
+++ b/lib/is-state.c
@@ -144,7 +144,7 @@ nbd_unlocked_aio_is_closed (struct nbd_handle *h)
return nbd_internal_is_state_closed (get_public_state (h));
}
-int
+unsigned
nbd_unlocked_aio_get_direction (struct nbd_handle *h)
{
return nbd_internal_aio_get_direction (get_public_state (h));
--
2.20.1
2019 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
...(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 (get_state (h));
+ return nbd_internal_is_state_closed (get_public_state (h));
}
diff --git a/lib/rw.c b/lib/rw.c
index b38d95b..ad9c8a0 100644
--- a/lib/rw.c
+++ b/lib/rw.c
@@ -201,7 +201,7 @@ nbd_internal_command_common (struct nb...
2019 Jun 05
1
[PATCH libnbd v2] lib: Atomically update h->state when leaving the locked region.
...(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 (get_state (h));
+ return nbd_internal_is_state_closed (get_public_state (h));
}
diff --git a/lib/rw.c b/lib/rw.c
index b38d95b..ad9c8a0 100644
--- a/lib/rw.c
+++ b/lib/rw.c
@@ -201,7 +201,7 @@ nbd_internal_command_common (struct nb...
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
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