search for: connection_get_status

Displaying 20 results from an estimated 21 matches for "connection_get_status".

2019 Apr 24
0
[nbdkit PATCH 1/4] server: Check for pthread lock failures
...+++++++-------- server/locks.c | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/server/connections.c b/server/connections.c index a30a541..b7d9a6a 100644 --- a/server/connections.c +++ b/server/connections.c @@ -91,11 +91,13 @@ connection_get_status (struct connection *conn) { int r; - if (conn->nworkers) - pthread_mutex_lock (&conn->status_lock); + if (conn->nworkers && + pthread_mutex_lock (&conn->status_lock)) + abort (); r = conn->status; - if (conn->nworkers) - pthread_mutex_unloc...
2019 Nov 04
3
[PATCH nbdkit 0/3] server: Fix crash on close.
This fixes the long-standing crash on close when nbdkit exits. I did try first to fix threads so we're using a proper thread pool, but that's difficult to implement. So this does the minimal change needed to fix the crash instead. There are still two segfaults that happen during running the test suite. One is deliberately caused (tests/test-captive.sh). The other appears to be an
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...n *) __attribute__((__nonnull__ (1))); +typedef void (*connection_close_function) (void); enum { HANDLE_OPEN = 1, /* Set if .open passed, so .close is needed */ @@ -234,29 +231,22 @@ struct connection { }; extern void handle_single_connection (int sockin, int sockout); -extern int connection_get_status (struct connection *conn) - __attribute__((__nonnull__ (1))); -extern int connection_set_status (struct connection *conn, int value) - __attribute__((__nonnull__ (1))); +extern int connection_get_status (void); +extern int connection_set_status (int value); /* protocol-handshake.c */ -extern i...
2020 Feb 11
4
[PATCH nbdkit v2 0/3] server: Remove explicit connection parameter.
v1 was here: https://www.redhat.com/archives/libguestfs/2020-February/msg00081.html v2 replaces struct connection *conn = GET_CONN; with GET_CONN; which sets conn implicitly and asserts that it is non-NULL. If we actually want to test if conn is non-NULL or behave differently, then you must use threadlocal_get_conn() instead, and some existing uses do that. Rich.
2020 Feb 11
5
[PATCH nbdkit 0/3] server: Remove explicit connection parameter.
The third patch is a large but mechanical change which gets rid of passing around struct connection * entirely within the server, preferring instead to reference the connection through thread-local storage. I hope this is a gateway to simplifying other parts of the code. Rich.
2020 Feb 12
0
[PATCH nbdkit 2/3] server: Rename ‘struct b_conn_handle’ to plain ‘struct handle’.
...BD_MAX_STRING + 1]; @@ -239,6 +247,12 @@ struct connection { connection_close_function close; }; +static inline struct handle * +get_handle (struct connection *conn, int i) +{ + return &conn->handles[i]; +} + extern void handle_single_connection (int sockin, int sockout); extern int connection_get_status (void); extern int connection_set_status (int value); diff --git a/server/backend.c b/server/backend.c index 616c24d8..9669ada1 100644 --- a/server/backend.c +++ b/server/backend.c @@ -154,7 +154,7 @@ int backend_open (struct backend *b, int readonly) { GET_CONN; - struct b_conn_handle *h =...
2020 Aug 27
0
[nbdkit PATCH v2 2/8] api: Add nbdkit_add_default_export
...t (exports); return p->plugin.list_exports (readonly, default_only, exports); } diff --git a/server/test-public.c b/server/test-public.c index 0149dd9b..ee71f2fc 100644 --- a/server/test-public.c +++ b/server/test-public.c @@ -66,7 +66,14 @@ threadlocal_get_conn (void) abort (); } -int connection_get_status (void) +int +connection_get_status (void) +{ + abort (); +} + +const char * +backend_default_export (struct backend *b, int readonly) { abort (); } diff --git a/plugins/sh/methods.c b/plugins/sh/methods.c index 8e2e4256..2192ae25 100644 --- a/plugins/sh/methods.c +++ b/plugins/sh/methods.c @@...
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...4 --- a/server/internal.h +++ b/server/internal.h @@ -194,6 +194,28 @@ extern int connection_set_handle (struct connection *conn, __attribute__((__nonnull__ (1 /* not 3 */))); extern void *connection_get_handle (struct connection *conn, size_t i) __attribute__((__nonnull__ (1))); +extern int connection_get_status (struct connection *conn) + __attribute__((__nonnull__ (1))); +extern int connection_set_status (struct connection *conn, int value) + __attribute__((__nonnull__ (1))); + +/* protocol-handshake.c */ +extern int protocol_handshake (struct connection *conn) + __attribute__((__nonnull__ (1))); +ext...
2019 Mar 18
3
[PATCH nbdkit 0/2] server: Split out NBD protocol code from connections code.
These are a couple of patches in preparation for the Block Status implementation. While the patches (especially the second one) are very large they are really just elementary code motion. Rich.
2020 Aug 27
2
Re: [nbdkit PATCH v2 2/8] api: Add nbdkit_add_default_export
...(readonly, default_only, exports); > } > diff --git a/server/test-public.c b/server/test-public.c > index 0149dd9b..ee71f2fc 100644 > --- a/server/test-public.c > +++ b/server/test-public.c > @@ -66,7 +66,14 @@ threadlocal_get_conn (void) > abort (); > } > > -int connection_get_status (void) > +int > +connection_get_status (void) > +{ > + abort (); > +} > + > +const char * > +backend_default_export (struct backend *b, int readonly) > { > abort (); > } > diff --git a/plugins/sh/methods.c b/plugins/sh/methods.c > index 8e2e4256..2192ae2...
2019 Apr 24
7
[nbdkit PATCH 0/4] More mutex sanity checking
I do have a question about whether patch 2 is right, or whether I've exposed a bigger problem in the truncate (and possibly other) filter, but the rest seem fairly straightforward. Eric Blake (4): server: Check for pthread lock failures truncate: Factor out reading real_size under mutex plugins: Check for mutex failures filters: Check for mutex failures filters/cache/cache.c
2019 Aug 03
5
[nbdkit PATCH 0/3] More responsive shutdown
We noticed while writing various libnbd tests that when the delay filter is in use, there are scenarios where we had to resort to SIGKILL to get rid of nbdkit, because it was non-responsive to SIGINT. I'm still trying to figure out the best way to add testsuite coverage of this, but already proved to myself that it works from the command line, under two scenarios that both used to cause long
2019 Aug 03
0
[nbdkit PATCH 3/3] server: Add and use nbdkit_nanosleep
...-1: + assert (errno != EINTR); + nbdkit_error ("poll: %m"); + return -1; + case 0: + return 0; + } + + /* We don't have to read the pipe-to-self; if poll returned an + * event, we know the connection should be shutting down. + */ + assert (quit || (conn && connection_get_status (conn) < 1)); + nbdkit_error ("aborting sleep to shut down"); + errno = ESHUTDOWN; + return -1; +#endif +} diff --git a/server/nbdkit.syms b/server/nbdkit.syms index f8eef214..2a024ed5 100644 --- a/server/nbdkit.syms +++ b/server/nbdkit.syms @@ -46,6 +46,7 @@ nbdkit_extents_fre...
2019 Mar 19
0
[PATCH nbdkit 3/9] server: Implement Block Status requests to read allocation status.
...e will + * require an overhaul. + */ + if (error == 0 && cmd == NBD_CMD_BLOCK_STATUS) { + error = block_status_final_map (flags, count, offset, extents_map, + &blocks, &nr_blocks); + } + /* Send the reply packet. */ send_reply: if (connection_get_status (conn) < 0) @@ -498,15 +712,23 @@ protocol_recv_request_send_reply (struct connection *conn) } /* Currently we prefer to send simple replies for everything except - * where we have to (ie. NBD_CMD_READ when structured_replies have - * been negotiated). However this prevents us from...
2020 Feb 12
5
[PATCH nbdkit 1/3] server: Rename global backend pointer to "top".
It's confusing to use the same terminology for a single backend as for the linked list of backends. In particular it's often not clear if we're calling the next backend or the whole chain of backends. --- server/internal.h | 14 ++++++++++-- server/connections.c | 20 ++++++++--------- server/locks.c | 2 +- server/main.c
2020 Aug 27
10
[nbdkit PATCH v2 0/8] exportname filter
This is a revision of my .default_export work, plus new work on .export_descriptions and a new exportname filter. I think it is now ready to check in. Things I'd still like in 1.22: - the file plugin should implement .list_exports (patch already posted, but it needs rebasing on this series) - the ext2 filter should override .list_exports when in exportname mode - the nbd plugin should be
2020 Aug 15
3
[PATCH EXPERIMENTAL nbdkit 0/2] Port to Windows using mingw.
The patches following do indeed allow you to compile nbdkit.exe, but it does not actually work yet. I'm posting this experimental series more as a work in progress and to get feedback. Note this does not require Windows itself to build or test. You can cross-compile it using mingw64-* packages on Fedora or Debian, and test it [spoiler alert: it fails] using Wine. Rich.
2019 Oct 04
6
[nbdkit PATCH 0/5] Another round of retry fixes
I still don't have .prepare/.finalize working cleanly across reopen, but did find a nasty bug where a botched assertion means we failed to notice reads beyond EOF in both the xz and retry filter. Refactoring backend.c will make .finalize work easier. Eric Blake (5): xz: Avoid reading beyond EOF retry: Check size before transactions tests: Test retry when get_size values change
2020 Sep 21
18
[nbdkit PATCH v3 00/14] exportname filter
It's been several weeks since I posted v2 (I got distracted by improving libnbd to better test things, which in turn surfaced some major memory leak problems in nbdsh that are now fixed). Many of the patches are minor rebases from v2, with the biggest changes being fallout from: - patch 2: rename nbdkit_add_default_export to nbdkit_use_default_export - overall: this missed 1.22, so update
2019 Mar 19
15
[PATCH nbdkit 0/9] [mainly for discussion and early review] Implement extents.
I want to post this but mainly for discussion and early review. It's not safe for these patches to all go upstream yet (because not all filters have been checked/adjusted), but if any patches were to go upstream then probably 1 & 2 only are safe. File, VDDK, memory and data plugins all work, although I have only done minimal testing on them. The current tests, such as they are, all