Displaying 20 results from an estimated 51 matches for "nbd_aio_is_ready".
2019 Jun 04
2
[PATCH libnbd] generator: Fix race condition when validating h->state.
The code for (eg) nbd_aio_pread starts by checking this outside
the lock:
if (!(nbd_aio_is_ready (h) || nbd_aio_is_processing (h))) {
However there can still be a race condition even though h->state is
atomic:
Thread A Thread B
(in a call that holds h->lock) (calling nbd_aio_pread)
--------------------------------------------------------------------
h-...
2019 Jun 04
0
[PATCH libnbd v2 1/4] examples, tests: Remove want_to_send / ready logic, increase limit on cmds in flight.
...+ * the same buffer for multiple in-flight requests. It doesn't
+ * matter here because we're just trying to write random stuff,
+ * but that would be Very Bad in a real application.
*/
- want_to_send =
- i > 0 && in_flight < MAX_IN_FLIGHT && nbd_aio_is_ready (nbd);
+ while (i > 0 && in_flight < MAX_IN_FLIGHT) {
+ offset = rand () % (exportsize - sizeof buf);
+ cmd = rand () & 1;
+ if (cmd == 0)
+ handle = nbd_aio_pwrite (nbd, buf, sizeof buf, offset, 0);
+ else
+ handle = nbd_aio_pread (nbd, buf, s...
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 Aug 14
3
[libnbd PATCH 0/2] Drop generated file from git
Rich recently patched things to generate one man page per function
rather than libnbd-api.3 (nice), but in doing so got stumped by a
problem with a fresh git clone (automake fails for any 'include'
directive that does not already exist). I've figured out how to hack
around it, but the hack requires GNU make. We already use GNU make
constructs elsewhere (such as $(wildcard)), but
2019 Jun 04
0
Re: [PATCH libnbd] generator: Fix race condition when validating h->state.
On 6/4/19 6:23 AM, Richard W.M. Jones wrote:
> The code for (eg) nbd_aio_pread starts by checking this outside
> the lock:
>
> if (!(nbd_aio_is_ready (h) || nbd_aio_is_processing (h))) {
>
> However there can still be a race condition even though h->state is
> atomic:
>
> Thread A Thread B
> (in a call that holds h->lock) (calling nbd_aio_pread)
> --------------------------------------...
2019 Jun 05
1
Re: [PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...tified by Eric Blake:
>
> Thread A Thread B
> (in a call that holds h->lock) (calling nbd_aio_pread)
> --------------------------------------------------------------------
> h->state is processing
> checks nbd_aio_is_ready
> (it's false)
> h->state is moved to READY
> checks nbd_aio_is_processing
> (it's false)
> validation check fails
>
> (...
2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...t;\
+Return the state of the handshake flags on this handle. When the
+handle has not yet completed a connection (see C<nbd_aio_is_created>),
+this returns the flags that the client is willing to use, provided
+the server also advertises those flags. After the connection is
+ready (see C<nbd_aio_is_ready>), this returns the flags that were
+actually agreed on between the server and client. If the NBD
+protocol defines new handshake flags, then the return value from
+a newer library version may include bits that were undefined at
+the time of compilation.";
+ see_also = ["L<nbd_s...
2019 Jun 05
0
[PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...is fixes a race condition identified by Eric Blake:
Thread A Thread B
(in a call that holds h->lock) (calling nbd_aio_pread)
--------------------------------------------------------------------
h->state is processing
checks nbd_aio_is_ready
(it's false)
h->state is moved to READY
checks nbd_aio_is_processing
(it's false)
validation check fails
(However the state was valid so the...
2019 Oct 04
0
[PATCH libnbd 3/4] api: Add nbd_connect_socket.
...BD server listening on C<hostname:port>.
Parameters behave as documented in L<nbd_connect_tcp(3)>.
+You can check if the connection is still connecting by calling
+L<nbd_aio_is_connecting(3)>, or if it has connected to the server
+and completed the NBD handshake by calling L<nbd_aio_is_ready(3)>,
+on the connection.";
+ };
+
+ "aio_connect_socket", {
+ default_call with
+ args = [ Fd "sock" ]; ret = RErr;
+ permitted_states = [ Created ];
+ shortdesc = "connect directly to a connected socket";
+ longdesc = "\
+Begin connecting...
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
[libnbd PATCH] api: Add nbd_supports_tls
...C<nbd_supports_uri>. Support for
+URIs that require TLS will fail if libnbd was not compiled with
+gnutls; you can test whether this is the case with C<nbd_supports_tls>.";
};
"connect_unix", {
@@ -1497,7 +1517,9 @@ and completed the NBD handshake by calling C<nbd_aio_is_ready>,
on the connection.
This call will fail if libnbd was not compiled with libxml2; you can
-test whether this is the case with C<nbd_supports_uri>.";
+test whether this is the case with C<nbd_supports_uri>. Support for
+URIs that require TLS will fail if libnbd was not compil...
2019 Jun 03
0
[PATCH libnbd discussion only 5/5] examples: Add concurrent writer example.
...;i);
+ goto error;
+ }
+
+ /* Do we want to send another request and there's room to issue it
+ * and the connection is in the READY state so it can be used to
+ * issue a request.
+ */
+ want_to_send =
+ i > 0 && in_flight < MAX_IN_FLIGHT && nbd_aio_is_ready (nbd);
+
+ fds[0].fd = nbd_aio_get_fd (nbd);
+ fds[0].events = want_to_send ? POLLOUT : 0;
+ fds[0].revents = 0;
+
+ dir = nbd_aio_get_direction (nbd);
+ if ((dir & LIBNBD_AIO_DIRECTION_WRITE) != 0) {
+ /* The concurrent writer is always writable, we don't have to
+...
2019 Oct 04
4
[PATCH libnbd 1/4] generator: Allow long ‘name - shortdesc’ in man pages.
For commands with long names and/or short descriptors, you can end up
going over 72 characters in the first line of the man page (causing
podwrapper to complain). Wrap these lines.
---
generator/generator | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/generator/generator b/generator/generator
index 7d3f656..ad1cb6b 100755
--- a/generator/generator
+++ b/generator/generator
2019 Sep 26
0
[PATCH libnbd 2/2] api: Implement local command with systemd socket activation.
...egin connecting to it over
stdin/stdout. Parameters behave as documented in
L<nbd_connect_command(3)>.
+You can check if the connection is still connecting by calling
+L<nbd_aio_is_connecting(3)>, or if it has connected to the server
+and completed the NBD handshake by calling L<nbd_aio_is_ready(3)>,
+on the connection.";
+ };
+
+ "aio_connect_socket_activation", {
+ default_call with
+ args = [ StringList "argv" ]; ret = RErr;
+ permitted_states = [ Created ];
+ shortdesc = "connect using systemd socket activation";
+ longdesc = "...
2019 Jun 04
9
[PATCH libnbd v2 0/4] api: Implement concurrent writer.
v1:
https://www.redhat.com/archives/libguestfs/2019-June/msg00014.html
I pushed a few bits which are uncontroversial. The main
changes since v1 are:
An extra patch removes the want_to_send / check for nbd_aio_is_ready
in examples/threaded-reads-and-writes.c. This logic was wrong since
commit 6af72b87 as was pointed out by Eric in his review. Comments
and structure of examples/concurrent-writes.c has been updated to
match.
Callbacks now return int instead of void. In some cases we ignore
this return value.
I...
2019 Jun 27
0
[libnbd PATCH 2/2] poll: Improve our interface
...xt to read from the server. If using L<poll(2)>
you would set C<events = POLLIN>. If C<revents> returns C<POLLIN>
-you would then call C<nbd_aio_notify_read>.
+or C<POLLHUP> you would then call C<nbd_aio_notify_read>.
Note that once libnbd reaches C<nbd_aio_is_ready>, this direction is
returned even before a command is issued via C<nbd_aio_pwrite> and
diff --git a/lib/poll.c b/lib/poll.c
index 982b172..d356afe 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -57,21 +57,28 @@ nbd_unlocked_poll (struct nbd_handle *h, int timeout)
set_error (errno, &quo...
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 Aug 14
0
[libnbd PATCH 2/2] docs: Drop docs/Makefile.inc from git
...read_structured \
- nbd_aio_pwrite \
- nbd_aio_disconnect \
- nbd_aio_flush \
- nbd_aio_trim \
- nbd_aio_cache \
- nbd_aio_zero \
- nbd_aio_block_status \
- nbd_aio_get_fd \
- nbd_aio_get_direction \
- nbd_aio_notify_read \
- nbd_aio_notify_write \
- nbd_aio_is_created \
- nbd_aio_is_connecting \
- nbd_aio_is_ready \
- nbd_aio_is_processing \
- nbd_aio_is_dead \
- nbd_aio_is_closed \
- nbd_aio_command_completed \
- nbd_aio_peek_command_completed \
- nbd_aio_in_flight \
- nbd_connection_state \
- nbd_get_package_name \
- nbd_get_version \
- nbd_kill_command \
- nbd_supports_tls \
- nbd_supports_uri \
- $(NULL)...
2020 Aug 11
3
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
On 8/11/20 12:12 PM, Richard W.M. Jones wrote:
> I think this needs extra documentation in docs/libnbd.pod because it's
> definitely not clear just from the rather thin manual page for
> set_opt_mode how it works. docs/libnbd.pod is a good place for a
> broader description of how it works.
Yes, good idea.
State-wise, the existing flow was:
Created
- Progress only by command
2019 Jun 03
10
[PATCH libnbd discussion only 0/5] api: Implement concurrent writer.
This works, but there's no time saving and I'm still investigating
whether it does what I think it does. Nevertheless I thought I would
post it because it (probably) implements the idea I had last night
outlined in:
https://www.redhat.com/archives/libguestfs/2019-June/msg00010.html
The meat of the change is patch 4. Patch 5 is an example which I
would probably fold into patch 4 for