Displaying 20 results from an estimated 1000 matches similar to: "[libnbd PATCH] disconnect: Prevent any further commands"
2020 Sep 11
3
[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
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 (commit f891340b), we
failed to mark nbd_shutdown as using a different bitmask than
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 05
1
[PATCH libnbd v2] lib: Atomically update h->state when leaving the locked region.
Split h->state into:
- h->public_state = the state on entry to the locked region
This is also the atomicly, publicly visible state.
- h->state = the real current state of the handle
When we leave the locked region we update h->public_state with
h->state, so that from outside the lock the handle appears to move
atomically from its previous state to the final state without
2019 Jul 18
0
[libnbd PATCH 2/2] lib: Do O(1) rather than O(n) queue insertion
We have no control over the user piling up lots of commands faster
than the server can accept (h->cmds_to_issue), or delaying retiring
those batched commands (h->cmds_in_flight), hence our use of O(n) list
insertion can be noticeable, since the growth of n can be unbounded
from our viewpoint. It's easy enough to track a tail pointer to keep
insertion O(1), to match that these two lists
2019 Jun 05
0
[PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
Split h->state into:
- h->state = the state on entry to the locked region
- h->next_state = the current state and what the "publicly visible"
state will become when we leave the locked region
Some calls to get_state become calls to get_next_state depending on
which of these they are trying to read. Calls to set_state become
set_next_state because that is what gets
2019 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
Split h->state into:
- h->public_state = the state on entry to the locked region
This is also the atomically, publicly visible state.
- h->state = the real current state of the handle
When we leave the locked region we update h->public_state with
h->state, so that from outside the lock the handle appears to move
atomically from its previous state to the final state without
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 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
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 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 Jul 18
1
Re: [libnbd PATCH 4/6] states: Prepare for aio notify callback
On 6/29/19 8:28 AM, Eric Blake wrote:
>
> We also want the client to be aware of any issued/in-flight commands
> that failed because they were stranded when the state machine moved to
> CLOSED or DEAD. Previously, nbd_aio_command_completed() would never
> locate such stranded commands, but adding a common point to fire the
> notifier for such commands makes it also possible to
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 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
2020 Mar 30
4
[libnbd PATCH 0/2] fix hangs against nbdkit 1.2
nbdkit 1.2 as a server waits for read() to see EOF, even after the
client has sent NBD_CMD_DISC. That was fixed in mbdkit 1.4; and most
modern NBD servers are smarter than this (they close() the write end
of their traffic soon after NBD_CMD_DISC). But it's easy enough to
revert nbdkit commit c70616f8 to get back to a server with the same
behavior as the older nbdkit, at which point both
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
2020 Sep 07
0
[libnbd PATCH 2/2] generator: Free closures on failure
We can easily demonstrate a memory leak when repeatedly calling
nbd_aio_pread from nbdsh in the wrong state. True, that isn't
something a sane client would normally do, but it's worth fixing.
The culprit: when nbd_aio_pread returns a cookie, we guarantee to
clean up the closure, but if we fail early and never scheduled the
command, nothing ever cleans up the closure. We could document
2019 May 22
0
[libnbd PATCH v2 1/5] lib: Refactor state event into command_common
The next patch wants to make queuing commands smarter; rather than
duplicating the logic at each command's call site, it's better to
centralize things in command_common, and to also make this helper
routine visible for use in NBD_CMD_DISC.
---
lib/disconnect.c | 17 +++--------------
lib/internal.h | 6 ++++++
lib/rw.c | 19 +++----------------
3 files changed, 12
2020 Sep 11
0
[libnbd PATCH v2 5/5] api: Add STRICT_BOUNDS/ZERO_SIZE to nbd_set_strict_mode
The NBD protocol states that a 0-length request is undefined; we were
inconsistent in that we let it through for read, write, and cache, but
blocked it for trim, zero, and block_status. The NBD protocol also
has documented rules on handling access beyond EOF, but we are
currently wasting traffic to the server when we can give the same
answer ourselves. Exposing these as two more strictness knobs
2020 Mar 28
0
[nbdkit PATCH v2] nbd: Avoid stuck poll() in nbdplug_close_handle()
We have been seeing sporadic hangs on test-nbd-tls-psk.sh and
test-nbd-tls.sh (on my machine, running those two in a loop with
commits 0a76cae4 and 09e34ba2 reverted would fail within 100
attempts), 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
2019 May 22
0
[libnbd PATCH v3 1/7] lib: Refactor command_common() to do more common work
Our construction of struct command_in_flight was ad hoc; most
parameters were set in command_common(), but extent callbacks were
done after the fact, and NBD_CMD_DISC was open-coding things.
Furthermore, every caller was triggering nbd_internal_run() for the
cmd_issue event; doing that in a central place makes it easier for the
next patch to improve that logic without duplicating the fix at each