Displaying 3 results from an estimated 3 matches for "reached_ready".
2019 May 22
0
[libnbd PATCH v2 2/5] commands: Allow for a command queue
...s(+), 4 deletions(-)
diff --git a/generator/states.c b/generator/states.c
index 202c305..a4eecbd 100644
--- a/generator/states.c
+++ b/generator/states.c
@@ -110,6 +110,12 @@ send_from_wbuf (struct nbd_connection *conn)
/*----- End of prologue. -----*/
/* STATE MACHINE */ {
+ READY:
+ conn->reached_ready = true;
+ if (conn->cmds_to_issue)
+ SET_NEXT_STATE (%ISSUE_COMMAND.START);
+ return 0;
+
DEAD:
if (conn->sock) {
conn->sock->ops->close (conn->sock);
diff --git a/lib/internal.h b/lib/internal.h
index 67bd52a..2d6ad9d 100644
--- a/lib/internal.h
+++ b/lib/internal....
2019 May 22
1
Re: [libnbd PATCH v2 2/5] commands: Allow for a command queue
...Returns true if the connection is connecting or handshaking
int nbd_[unlocked_]aio_is_processing (conn)
Returns true if the connection is issuing or replying to
commands (but not in the READY state)
I will post these later this morning.
I believe they 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)) {...
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