search for: try_deadlock

Displaying 15 results from an estimated 15 matches for "try_deadlock".

2019 May 21
0
[libnbd] tmp patch adding deadlock test
...+#include <errno.h> +#include <poll.h> +#include <time.h> +#include <assert.h> + +#include <libnbd.h> + +/* The single NBD handle. */ +static struct nbd_handle *nbd; + +/* Buffers used for the test. */ +static char *in, *out; +static int64_t packetsize; + +static int +try_deadlock (void *arg) +{ + struct pollfd fds[1]; + struct nbd_connection *conn; + char buf[512]; + size_t i, j; + int64_t handles[2]; + size_t in_flight; /* counts number of requests in flight */ + int dir, r, cmd; + bool want_to_send; + + /* The single thread "owns" the connection....
2019 May 22
0
[libnbd PATCH v3 7/7] examples: Add example to demonstrate just-fixed deadlock scenario
...+#include <poll.h> +#include <time.h> +#include <assert.h> +#include <signal.h> + +#include <libnbd.h> + +/* The single NBD handle. */ +static struct nbd_handle *nbd; + +/* Buffers used for the test. */ +static char *in, *out; +static int64_t packetsize; + +static int +try_deadlock (void *arg) +{ + struct pollfd fds[1]; + struct nbd_connection *conn; + size_t i; + int64_t handles[2], done; + size_t in_flight; /* counts number of requests in flight */ + int dir, r; + + /* The single thread "owns" the connection. */ + conn = nbd_get_connection (nbd, 0);...
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...t; or Maybe: s/If/For optional callbacks, if/ (coupled with the observation made earlier today that we still want a followup patch to better document Closure vs. OClosure on which callbacks do not allow a NULL fn in libnbd-api.3). > +++ b/examples/batched-read-write.c > @@ -53,12 +53,13 @@ try_deadlock (void *arg) > > /* Issue commands. */ > cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, > - NULL, NULL, 0); > + NBD_NULL_CALLBACK(completion), 0); A bit more verbose, but the macro cuts it down from something even...
2019 Jun 29
0
[libnbd PATCH 1/6] api: Add nbd_aio_in_flight
...tests/aio-parallel.c | 15 +++++-------- 7 files changed, 77 insertions(+), 45 deletions(-) diff --git a/examples/batched-read-write.c b/examples/batched-read-write.c index 90dfe86..194ad1c 100644 --- a/examples/batched-read-write.c +++ b/examples/batched-read-write.c @@ -48,26 +48,22 @@ try_deadlock (void *arg) struct pollfd fds[1]; size_t i; int64_t handles[2], done; - size_t in_flight; /* counts number of requests in flight */ int dir, r; /* Issue commands. */ - in_flight = 0; handles[0] = nbd_aio_pread (nbd, in, packetsize, 0, 0); if (handles[0] == -1) {...
2019 Aug 14
0
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...t;nbd_set_debug_callback>, > > 2 spaces looks odd (emacs thinks eg. ended a sentence) OK fixed in my copy. Interesting fact about emacs I-search: It doesn't let you search for double spaces for some reason. > > +++ b/examples/batched-read-write.c > > @@ -53,12 +53,13 @@ try_deadlock (void *arg) > > > > /* Issue commands. */ > > cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, > > - NULL, NULL, 0); > > + NBD_NULL_CALLBACK(completion), 0); > > A bit more verbose, but the mac...
2019 May 21
9
[libnbd PATCH 0/3] Avoid deadlock with in-flight commands
This might not be the final solution, but it certainly seems to solve a deadlock for me that I could trigger by using 'nbdkit --filter=noparallel memory 512k' and calling nbd_aio_pread for a request larger than 256k (enough for the Linux kernel to block the server until libnbd read()s), immediately followed by nbd_aio_pwrite for a request larger than 256k (enough to block libnbd until the
2019 Aug 14
1
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...s of 1 or more spaces in text as a match to single space in I-search. It's often nicer that way, but does sometimes get in the way; Regexp I-search with '[ ]' is my trick for finding an exact space. > >>> +++ b/examples/batched-read-write.c >>> @@ -53,12 +53,13 @@ try_deadlock (void *arg) >>> >>> /* Issue commands. */ >>> cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, >>> - NULL, NULL, 0); >>> + NBD_NULL_CALLBACK(completion), 0); >> >> A bit mor...
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 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 Aug 13
0
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...ata> pointer. This is passed as the second parameter to the callback. The opaque pointer is only diff --git a/examples/batched-read-write.c b/examples/batched-read-write.c index d39a1e5..378c2e0 100644 --- a/examples/batched-read-write.c +++ b/examples/batched-read-write.c @@ -52,12 +52,13 @@ try_deadlock (void *arg) int r; /* Issue commands. */ - cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, 0); + cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, + NULL, NULL, 0); if (cookies[0] == -1) { fprintf (stderr, "%s\n", nbd_get_error ());...
2019 Aug 13
2
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
This applies on top of the OClosure v2 series posted a few minutes ago. Rich.
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...re not needed +because you can use closures to achieve the same effect. =head2 Callback lifetimes diff --git a/examples/batched-read-write.c b/examples/batched-read-write.c index 378c2e0..a6063af 100644 --- a/examples/batched-read-write.c +++ b/examples/batched-read-write.c @@ -53,12 +53,13 @@ try_deadlock (void *arg) /* Issue commands. */ cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, - NULL, NULL, 0); + NBD_NULL_CALLBACK(completion), 0); if (cookies[0] == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); g...
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
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is
2019 Jun 29
19
[libnbd PATCH 0/6] new APIs: aio_in_flight, aio_FOO_notify
I still need to wire in the use of *_notify functions into nbdkit to prove whether it makes the code any faster or easier to maintain, but at least the added example shows one good use case for the new API. Eric Blake (6): api: Add nbd_aio_in_flight generator: Allow DEAD state actions to run generator: Allow Int64 in callbacks states: Prepare for aio notify callback api: Add new