search for: lock_init_thread_model

Displaying 20 results from an estimated 26 matches for "lock_init_thread_model".

2018 Jan 19
1
[PATCH nbdkit] locks: Cache the plugin thread model.
...--git a/src/internal.h b/src/internal.h index 28b1aaf..8047b3b 100644 --- a/src/internal.h +++ b/src/internal.h @@ -181,6 +181,7 @@ struct backend { extern struct backend *plugin_register (const char *_filename, void *_dl, struct nbdkit_plugin *(*plugin_init) (void)); /* locks.c */ +extern void lock_init_thread_model (void); extern void lock_connection (void); extern void unlock_connection (void); extern void lock_request (struct connection *conn); diff --git a/src/locks.c b/src/locks.c index 62b2dd0..bd8fd99 100644 --- a/src/locks.c +++ b/src/locks.c @@ -38,15 +38,24 @@ #include "internal.h"...
2018 Jun 06
2
[PATCH nbdkit] locks: Remove debugging messages about
The messages are not really useful to us, but they do bloat the debugging output of virt-v2v massively: nbdkit: python[1]: debug: acquire global request lock nbdkit: python[1]: debug: acquire per-connection request lock nbdkit: python[1]: debug: acquire unload prevention lock nbdkit: python[1]: debug: pwrite count=2097152 offset=4628414464 fua=0 nbdkit: python[1]: debug: release unload prevention
2018 Jun 06
0
[PATCH nbdkit] locks: Remove debugging messages about acquiring/releasing locks.
--- src/locks.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/locks.c b/src/locks.c index bd8fd99..1724b5a 100644 --- a/src/locks.c +++ b/src/locks.c @@ -56,53 +56,39 @@ lock_init_thread_model (void) void lock_connection (void) { - if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) { - debug ("acquire connection lock"); + if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) pthread_mutex_lock (&connection_lock); - } } void unlo...
2019 Apr 24
0
[nbdkit PATCH 1/4] server: Check for pthread lock failures
...lock (&conn->status_lock); + if (conn->nworkers && + pthread_mutex_unlock (&conn->status_lock)) + abort (); return value; } diff --git a/server/locks.c b/server/locks.c index f4d6497..d70baf2 100644 --- a/server/locks.c +++ b/server/locks.c @@ -55,49 +55,59 @@ lock_init_thread_model (void) void lock_connection (void) { - if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) - pthread_mutex_lock (&connection_lock); + if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS && + pthread_mutex_lock (&connection_lock)) + abort ()...
2019 Nov 04
3
[PATCH nbdkit v2 0/2] Implement fuzzing using Clang's libFuzzer.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-November/msg00003.html This version depends on: https://www.redhat.com/archives/libguestfs/2019-November/msg00004.html and this series: https://www.redhat.com/archives/libguestfs/2019-November/msg00009.html The delta has been reduced slightly because of changes made possible by cleaning up and fixing the quit path in nbdkit. It's
2020 Apr 14
0
[nbdkit PATCH v2 2/3] server: Sanitize stdin/out before running plugin code
...(STDIN_FILENO); + close (STDOUT_FILENO); + if (open ("/dev/null", O_RDONLY) != STDIN_FILENO || + open ("/dev/null", O_WRONLY) != STDOUT_FILENO) { + perror ("open"); + exit (EXIT_FAILURE); + } + /* Select the correct thread model based on config. */ lock_init_thread_model (); @@ -918,7 +954,7 @@ start_serving (void) change_user (); write_pidfile (); threadlocal_new_server_thread (); - handle_single_connection (0, 1); + handle_single_connection (orig_in, orig_out); return; } -- 2.26.0
2020 Apr 04
0
[nbdkit PATCH 2/2] server: Sanitize stdin/out before running plugin code
...(STDIN_FILENO); + close (STDOUT_FILENO); + if (open ("/dev/null", O_RDONLY) != STDIN_FILENO || + open ("/dev/null", O_WRONLY) != STDOUT_FILENO) { + perror ("open"); + exit (EXIT_FAILURE); + } + /* Select the correct thread model based on config. */ lock_init_thread_model (); @@ -918,7 +949,7 @@ start_serving (void) change_user (); write_pidfile (); threadlocal_new_server_thread (); - handle_single_connection (0, 1); + handle_single_connection (orig_in, orig_out); return; } diff --git a/tests/test-layers-plugin.c b/tests/test-layers-pl...
2020 Aug 05
2
[PATCH nbdkit 1/2] server: Call .get_ready before redirecting stdin/stdout to /dev/null.
...gin.c | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/server/main.c b/server/main.c index 2f0aaf07..11c1614b 100644 --- a/server/main.c +++ b/server/main.c @@ -693,6 +693,11 @@ main (int argc, char *argv[]) /* Select the correct thread model based on config. */ lock_init_thread_model (); + /* Tell the plugin that we are about to start serving. This must be + * called before we change user, fork, or open any sockets. + */ + top->get_ready (top); + /* Sanitize stdin/stdout to /dev/null, after saving the originals * when needed. We are still single-threaded at...
2020 Apr 04
6
[nbdkit PATCH 0/2] stdin/out cleanups
This is what I've been playing with in response to my earlier question about what to do with 'nbdkit -s sh -' (https://www.redhat.com/archives/libguestfs/2020-April/msg00032.html) I'm still open to ideas on a better name, and/or whether adding <stdbool.h> to our public include files is a good idea (if not, returning int instead of bool is tolerable). Eric Blake (2):
2020 Mar 19
5
[nbdkit PATCH 0/2] More caching of initial setup
When I added .can_FOO caching in 1.16, I missed the case that the sh plugin itself was calling .can_flush twice in some situations (in order to default .can_fua). Then right after, I regressed it to call .can_zero twice (in order to default .can_fast_zero). I also missed that .thread_model could use better caching, because at the time, I did not add testsuite coverage. Fix that now. Eric Blake
2019 May 17
4
[nbdkit PATCH 0/3] Add noparallel filter
Being able to programmatically force nbdkit to be less parallel can be useful during testing. I was less sure about patch 3, but if you like it, I'm inclined to instead squash it into patch 1. This patch is written to apply after my NBD_CMD_CACHE work (since I touched the nocache filter); but can be rearranged if we think this series should go in first while that one undergoes any adjustments
2020 Feb 22
2
Re: Plans for nbdkit 1.18 release?
Eric: Did you want to take this one any further? It might be one that we save for > 1.18: https://www.redhat.com/archives/libguestfs/2020-February/thread.html#00206 Another thing I've been thinking about for some time is splitting .config_complete into .config_complete + .get_ready (new name TBD). At the moment .config_complete is both the place where we finish processing config, and
2020 Feb 12
5
[PATCH nbdkit 1/3] server: Rename global backend pointer to "top".
...if (!quit) { lock_request (); - backend_close (backend); + backend_close (top); unlock_request (); } diff --git a/server/locks.c b/server/locks.c index f005710d..6211648d 100644 --- a/server/locks.c +++ b/server/locks.c @@ -69,7 +69,7 @@ name_of_thread_model (int model) void lock_init_thread_model (void) { - thread_model = backend->thread_model (backend); + thread_model = top->thread_model (top); debug ("using thread model: %s", name_of_thread_model (thread_model)); } diff --git a/server/main.c b/server/main.c index 550a8714..dbeca624 100644 --- a/server/main.c +++ b...
2020 Feb 22
1
Re: Plans for nbdkit 1.18 release?
...------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/server/main.c b/server/main.c index 8aa8b497..3bc59781 100644 --- a/server/main.c +++ b/server/main.c @@ -671,10 +671,25 @@ main (int argc, char *argv[]) /* Select the correct thread model based on config. */ lock_init_thread_model (); - set_up_quit_pipe (); -#if !ENABLE_LIBFUZZER - set_up_signals (); -#endif + /* If the user has mixed up -p/--run/-s/-U/--vsock options, then + * give an error. + * + * XXX Actually the server could easily be extended to handle both + * TCP/IP and Unix sockets, or even multiple TCP...
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 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...ct backend *filter_register (struct backend *next, size_t index, + const char *filename, void *dl, + struct nbdkit_filter *(*filter_init) (void)) + __attribute__((__nonnull__ (1, 3, 4, 5))); /* locks.c */ extern void lock_init_thread_model (void); extern void lock_connection (void); extern void unlock_connection (void); -extern void lock_request (struct connection *conn); -extern void unlock_request (struct connection *conn); +extern void lock_request (struct connection *conn) + __attribute__((__nonnull__ (1))); +extern void unloc...
2018 Jan 19
0
[PATCH nbdkit filters-v2 2/5] Introduce filters.
...er (size_t index, const char *filename, void *dl, struct nbdkit_plugin *(*plugin_init) (void)); + +/* filters.c */ +extern struct backend *filter_register (struct backend *next, size_t index, const char *filename, void *dl, struct nbdkit_filter *(*filter_init) (void)); /* locks.c */ extern void lock_init_thread_model (void); diff --git a/src/main.c b/src/main.c index 90d464a..29332c4 100644 --- a/src/main.c +++ b/src/main.c @@ -64,7 +64,8 @@ static int is_short_name (const char *); static char *make_random_fifo (void); -static struct backend *open_plugin_so (const char *filename, int short_name); +static st...
2018 Jan 19
0
[PATCH nbdkit filters-v3 3/7] Introduce filters.
...er (size_t index, const char *filename, void *dl, struct nbdkit_plugin *(*plugin_init) (void)); + +/* filters.c */ +extern struct backend *filter_register (struct backend *next, size_t index, const char *filename, void *dl, struct nbdkit_filter *(*filter_init) (void)); /* locks.c */ extern void lock_init_thread_model (void); diff --git a/src/main.c b/src/main.c index 90d464a..29332c4 100644 --- a/src/main.c +++ b/src/main.c @@ -64,7 +64,8 @@ static int is_short_name (const char *); static char *make_random_fifo (void); -static struct backend *open_plugin_so (const char *filename, int short_name); +static st...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here: https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html In v2 I have provided two patches: The first patch extends attribute((nonnull)) to most internal functions, but not to the external API. The second patch uses a macro so that attribute((format)) is only used in the public API on GCC or Clang. At least in theory these headers could be used by a C compiler which
2020 Apr 14
6
[nbdkit PATCH v2 0/3] more consistent stdin/out handling
In v2: - use int instead of bool in the public header - split the tests from the code - don't overload test-layers; instead, add new tests - add a missing fflush exposed by the new tests - other minor cleanups Eric Blake (3): server: Add nbdkit_stdio_safe server: Sanitize stdin/out before running plugin code server: More tests of stdin/out handling docs/nbdkit-plugin.pod |