search for: thread_data

Displaying 20 results from an estimated 23 matches for "thread_data".

2017 Nov 17
0
[nbdkit PATCH 4/4] sockets: Fix lifetime of thread_data
...pthread_create() unless you can guarantee that the new thread will complete prior to the calling thread returning and ending the lifetime of that storage. We were violating this, with the result in a SEGV in the detached child thread during threadlocal_set_sockaddr() with parameters pointing into thread_data which was reached at the same time the main thread was trying to call exit(). Signed-off-by: Eric Blake <eblake@redhat.com> --- src/sockets.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/sockets.c b/src/sockets.c index edb63b3..1d63523...
2017 Nov 17
7
[nbdkit PATCH 0/4] thread-safety issues prior to parallel handling
...ang is rather insidious; see my other email https://www.redhat.com/archives/libguestfs/2017-November/msg00139.html) Eric Blake (4): errors: Avoid interleaved errors from parallel threads threadlocal: Copy thread name plugins: Make plugin_name() reliable past unload sockets: Fix lifetime of thread_data src/errors.c | 30 +++++++++++++++++++++++++++++- src/plugins.c | 8 ++++++-- src/sockets.c | 27 ++++++++++++++++++--------- src/threadlocal.c | 17 +++++++++++++---- 4 files changed, 66 insertions(+), 16 deletions(-) -- 2.13.6
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
When accepting a connection on a TCP or Unix domain socket we recorded the peer address in both the thread_data struct and thread-local storage. But for no reason because it was never used anywhere. Since we were only allocating a ‘struct sockaddr’ (rather than a ‘struct sockaddr_storage’) it's likely that some peer addresses would have been truncated. Remove all this code, it had no effect. Plugins...
2013 May 01
1
[PATCH] tests/c-api: Allow the C API tests to run in parallel.
I'm not going to put this upstream because there's no benefit. However it is useful to record the patch on the mailing list. Rich.
2019 May 30
0
[PATCH nbdkit 2/2] server: Disable Nagle's algorithm.
...tinet/in.h> +#include <netinet/tcp.h> #include <netdb.h> -#include <poll.h> -#include <errno.h> -#include <assert.h> #ifdef HAVE_LIBSELINUX #include <selinux/selinux.h> @@ -273,6 +275,7 @@ accept_connection (int listen_sock) pthread_t thread; struct thread_data *thread_data; static size_t instance_num = 1; + const int flag = 1; thread_data = malloc (sizeof *thread_data); if (!thread_data) { @@ -293,6 +296,11 @@ accept_connection (int listen_sock) return; } + /* Disable Nagle's algorithm on this socket. However we don't want...
2019 May 30
2
[PATCH nbdkit 1/2] nbd: Fix -Werror=maybe-uninitialized warning.
GCC is concerned that if we never go round the loop then fd will be uninitialized. By asserting that getaddrinfo set result != NULL we can avoid this. nbd.c: In function ‘nbd_open_handle’: nbd.c:974:5: error: ‘fd’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 974 | close (fd); | ^~~~~~~~~~ nbd.c:954:7: note: ‘fd’ was declared here 954 | int fd;
2019 Nov 02
2
[PATCH nbdkit] server: Use GCC hints to move debug and error handling code out of hot paths.
...ength, blocks[i].status_flags); #endif /* Convert to big endian for the protocol. */ diff --git a/server/sockets.c b/server/sockets.c index 1585a09..119cb99 100644 --- a/server/sockets.c +++ b/server/sockets.c @@ -365,7 +365,7 @@ accept_connection (int listen_sock) const int flag = 1; thread_data = malloc (sizeof *thread_data); - if (!thread_data) { + if (unlikely (!thread_data)) { perror ("malloc"); return; } @@ -409,7 +409,7 @@ accept_connection (int listen_sock) pthread_attr_setdetachstate (&attrs, PTHREAD_CREATE_DETACHED); err = pthread_create (&th...
2015 Oct 07
2
[PATCH 0/2] New APIs: set-identifier, get-identifier
This is very useful for debugging multithreaded programs. Rich.
2020 Apr 28
2
[PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
On Haiku tests/test-socket-activation failed with: nbdkit: locks.c:96:lock_request: conn != NULL called from server/sockets.c: accept_connection in the fallback path which does: lock_request (); thread_data->sock = set_cloexec (accept (listen_sock, NULL, NULL)); unlock_request () Because there is no current connection in this thread this code fails. However it should be possible to call lock_request without a connection, provided that thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS (w...
2016 Mar 06
8
[PATCH 0/5] Use less stack.
Various changes/fixes to use smaller stack frames. Rich.
2019 Jul 31
13
[nbdkit PATCH 0/8] fd leak safety
There's enough here to need a review; some of it probably needs backporting to stable-1.12. This probably breaks tests on Haiku or other platforms that have not been as on-the-ball about atomic CLOEXEC; feel free to report issues that arise, and I'll help come up with workarounds (even if we end up leaving a rare fd leak on less-capable systems). Meanwhile, I'm still working on my
2016 Mar 07
2
[PATCH v2] Use less stack.
...tError (); diff --git a/df/parallel.c b/df/parallel.c index 114cc27..aa37bc3 100644 --- a/df/parallel.c +++ b/df/parallel.c @@ -85,6 +85,8 @@ start_threads (size_t option_P, guestfs_h *options_handle, work_fn work) size_t i, nr_threads; int err, errors; void *status; + CLEANUP_FREE struct thread_data *thread_data = NULL; + CLEANUP_FREE pthread_t *threads = NULL; if (nr_domains == 0) /* Nothing to do. */ return 0; @@ -98,8 +100,10 @@ start_threads (size_t option_P, guestfs_h *options_handle, work_fn work) if (verbose) fprintf (stderr, "parallel: creating %zu thre...
2019 Aug 02
23
[nbdkit PATCH v2 00/17] fd leak safety
This is a major rewrite compared to my v1 series, where I've tried a lot harder to ensure that we still accommodate building on Haiku (although I have not actually yet fired up a Haiku VM to try it for myself). I also managed to make the sh plugin fully parallel, on capable platforms. See also my question on patch 10 on whether I've picked the best naming convention. Eric Blake (17):
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 Apr 28
0
Re: [PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
On 4/28/20 11:45 AM, Richard W.M. Jones wrote: > On Haiku tests/test-socket-activation failed with: > > nbdkit: locks.c:96:lock_request: conn != NULL > > called from server/sockets.c: accept_connection > in the fallback path which does: > lock_request (); > thread_data->sock = set_cloexec (accept (listen_sock, NULL, NULL)); > unlock_request () > > Because there is no current connection in this thread this code fails. > > However it should be possible to call lock_request without a > connection, provided that > thread_model <= NBDKI...
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...95 100644 --- a/tests/qemu/qemu-boot.c +++ b/tests/qemu/qemu-boot.c @@ -32,6 +32,7 @@ #include <getopt.h> #include <limits.h> #include <errno.h> +#include <error.h> #include <pthread.h> #include "guestfs.h" @@ -197,10 +198,8 @@ run_test (size_t P) thread_data = malloc (sizeof (struct thread_data) * P); threads = malloc (sizeof (pthread_t) * P); - if (thread_data == NULL || threads == NULL) { - perror ("malloc"); - exit (EXIT_FAILURE); - } + if (thread_data == NULL || threads == NULL) + error (EXIT_FAILURE, errno, "malloc&qu...
2006 Oct 27
0
Wine release 0.9.24
...d3d: Add D3DVS_RASTOUT_OFFSETS to the WINED3D namespace. wined3d: Add D3DTA masks to the WINED3D namespace. wined3d: Add D3DBLEND to the WINED3D namespace. wined3d: Add D3DZBUFFERTYPE to the WINED3D namespace. Jacek Caban (18): mshtml: Don't crash in remove_doc_tasks if thread_data is not allocated. mshtml: Load page from moniker if AsyncOpen fails. shdocvw: Added IDocHostUIHandler2 test. shdocvw: Move common Navigate2 code to navigate_url. shdocvw: Use navigate_url in WebBrowser::Navigate. shdocvw: Added WebBrowser::Navigate implementation....
2016 Sep 08
4
[PATCH 0/3] Use gnulib's getprogname
Hi, this series update libguestfs to a recent gnulib version, so that we can use its new getprogname module, and solve altogether one of the porting issues (the need for 'program_name' by the error module of gnulib), and have a single way to get the name of the current program. A number of changes in tools mostly, although mechanical. Thanks, Pino Toscano (3): Update gnulib to latest
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
2016 Apr 04
0
[PATCH 2/2] Use 'error' function for fprintf followed by exit.
...); - exit (EXIT_FAILURE); - } + if (optind != argc) + error (EXIT_FAILURE, 0, + "extra arguments found on the command line"); /* Calculate the number of threads to use. */ if (P > 0) @@ -205,11 +194,8 @@ run_test (size_t P) for (i = 0; i < P; ++i) { thread_data[i].thread_num = i; err = pthread_create (&threads[i], NULL, start_thread, &thread_data[i]); - if (err != 0) { - fprintf (stderr, "%s: pthread_create[%zu]: %s\n", - guestfs_int_program_name, i, strerror (err)); - exit (EXIT_FAILURE); - } + if (...