Displaying 20 results from an estimated 1000 matches similar to: "[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag"
2020 Sep 17
0
Re: [libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
On Fri, Sep 11, 2020 at 09:31:11AM -0500, Eric Blake wrote:
> As mentioned in commits 176fc4ea and 609c25f0, our original plan in
> adding a flags argument to nbd_shutdown was to let us specify
> different behaviors at the libnbd level, rather than NBD protocol
> flags (for that, the user has nbd_aio_disconnect). But when we later
> parameterized OFlags to accept various bitmasks
2019 Jun 28
1
[libnbd PATCH] disconnect: Prevent any further commands
Once the client has requested NBD_CMD_DISC, the protocol states that
it must not send any further information to the server (further writes
may still be needed for a clean TLS shutdown, but that's a different
matter requiring more states).
Our state machine can prevent some of this if we have moved to CLOSED,
but that's not foolproof because we can queue commands that can't be
written
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
2020 Sep 17
1
Re: [libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
On 9/17/20 8:22 AM, Richard W.M. Jones wrote:
> On Fri, Sep 11, 2020 at 09:31:11AM -0500, Eric Blake wrote:
>> As mentioned in commits 176fc4ea and 609c25f0, our original plan in
>> adding a flags argument to nbd_shutdown was to let us specify
>> different behaviors at the libnbd level, rather than NBD protocol
>> flags (for that, the user has nbd_aio_disconnect). But
2023 Mar 08
2
[PATCH libnbd] lib/errors.c: Fix assert fail in exit path in multi-threaded code
When a highly multi-threaded program such as nbdcopy encounters an
error, there is a race condition in the library which can cause an
assertion failure and thus a core dump:
(1) An error occurs on one of the threads. nbdcopy calls exit(3).
(2) In lib/errors.c, the destructor calls pthread_key_delete.
(3) Another thread which is still running also encounters an error,
and inside libnbd the
2020 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
In v2:
- now based on my proposal to add LIBNBD_SHUTDOWN_IMMEDIATE
- four flags instead of two: STRICT_FLAGS is new (patch 4),
and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5)
- various refactorings for more shared code and less duplication
Eric Blake (5):
api: Add xxx_MASK constant for each Flags type
generator: Refactor filtering of accepted OFlags
api: Add
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
2019 Jun 29
0
[libnbd PATCH 1/6] api: Add nbd_aio_in_flight
Some clients need to know when it is safe to issue NBD_CMD_DISC, or to
decide whether calling poll(POLLIN) will block indefinitely because
the server isn't expected to respond. Make this easier to learn by
tracking the count of commands we have queued up to send, as well as
the count of commands where we are waiting on the server's response.
Update tests/aio-parallel* and
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 Jul 18
3
[libnbd PATCH 0/2] in_flight improvements
Noticed while thinking about the recent threads wondering if we need a
more efficient lookup from cookie back to command. Both of these fix
bugs, but are tricky enough that I'm posting for review.
Eric Blake (2):
lib: Decrement in_flight at response, not retirement
lib: Do O(1) rather than O(n) queue insertion
generator/states-issue-command.c | 2 ++
generator/states-reply.c |
2019 Jun 29
0
[libnbd PATCH 4/6] states: Prepare for aio notify callback
Having the client polling thread perform an O(n) loop over all known
in-flight commands after each time the poll woke up is somewhat
inefficient, and in a multi-threaded setup requires additional locking
beyond libnbd to track the set of known command handles. Better is a
way for aio commands to call a notify callback the moment a specific
command is ready to complete, and then a separate thread
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
2020 Mar 27
1
Re: [nbdkit PATCH 2/2] nbd: Reorder cleanup to avoid getting stuck in poll()
On Fri, Mar 27, 2020 at 05:33:28PM -0500, Eric Blake wrote:
> We have been seeing sporadic hangs on test-nbd-tls-psk.sh, where even
> though the client to the 'nbdkit nbd' process has cleanly exited,
> things are stalled in .close where nbd is trying to pthread_join() the
> reader thread, while the reader thread is itself blocked on a poll()
> that will never make additional
2019 Jun 28
3
[libnbd PATCH] tests: Enhance errors test
Let's check for a quite a few more errors. Among other things, this
adds some coverage for a few things I've patched recently.
---
And these enhancements set me up for my next fix: making NBD_CMD_DISC
prevent future commands.
tests/errors.c | 167 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 154 insertions(+), 13 deletions(-)
diff --git a/tests/errors.c
2023 Mar 08
2
[libnbd PATCH v2] lib/errors.c: Fix assert fail in exit path in multi-threaded code
When a highly multi-threaded program such as nbdcopy encounters an
error, there is a race condition in the library which can cause an
assertion failure and thus a core dump:
(1) An error occurs on one of the threads. nbdcopy calls exit(3).
(2) In lib/errors.c, the destructor calls pthread_key_delete.
(3) Another thread which is still running also encounters an error,
and inside libnbd the
2019 Aug 15
1
[PATCH libnbd] docs: Change docs/Makefile.inc back to a regular include, readd to git.
‘make clean && make’ was not rebuilding the docs/*.3 files. The
reason is obscure:
- docs/Makefile has rules:
MANS = $(man_MANS)
all: all-am
all-am: Makefile $(MANS)
- sinclude docs/Makefile.inc happened long after MANS is defined, so
MANS held the earlier version of $(man_MANS) without the api-built
man pages listed.
This was confirmed by looking at the output of
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 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_*.
The original nbd_aio_* (non-callback) functions are removed and
replaced with the renamed callback variants.
This is a simple mechanical change to the API:
(1) Any existing call to nbd_aio_*_callback can simply be renamed to
nbd_aio_*
(2) Any existing call to nbd_aio_* must have two extra NULL parameters
added before the final flags parameter.
In non-C languages, only change (1) is
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
The definition of functions that take a callback is changed so that
the callback and user_data are combined into a single structure, eg:
int64_t nbd_aio_pread (struct nbd_handle *h,
void *buf, size_t count, uint64_t offset,
- int (*completion_callback) (/*..*/), void *user_data,
+ nbd_completion_callback completion_callback,
uint32_t flags);
Several