Displaying 20 results from an estimated 61 matches for "lock_request".
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...
2020 Apr 28
2
[PATCH nbdkit] server: Fix parameters of lock_request, unlock_request
Patch itself is not controversial.
However I do wonder if we want to change all these constructs so that
instead of using #ifdef we use something like:
if (HAVE_PIPE2) {
// normal path
}
else {
// fallback
}
(It wouldn't actually work as written above because HAVE_PIPE2 is not
always defined, but you get the idea.)
This would allow us to test that the fallback paths still
2020 Apr 28
0
[PATCH nbdkit] server: Fix parameters of lock_request, unlock_request on fallback path.
On Haiku which doesn't have pipe2 we were using the fallback path.
However a previous change to remove the conn parameter of lock_request
and unlock_request had not been made to this code and so it failed to
compile.
Fixes: commit 91023f269d4cea56f573a1aa0d880b12052f6e1e
---
server/connections.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/server/connections.c b/server/connections.c
index c7b55ca1....
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...
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...nt sockout)
{
int r;
- plugin_lock_connection ();
+ lock_connection ();
r = _handle_single_connection (sockin, sockout);
- plugin_unlock_connection ();
+ unlock_connection ();
return r;
}
@@ -740,12 +740,12 @@ negotiate_handshake (struct connection *conn)
{
int r;
- plugin_lock_request (conn);
+ lock_request (conn);
if (!newstyle)
r = _negotiate_handshake_oldstyle (conn);
else
r = _negotiate_handshake_newstyle (conn);
- plugin_unlock_request (conn);
+ unlock_request (conn);
return r;
}
@@ -1057,9 +1057,9 @@ recv_request_send_reply (struct connection *conn...
2018 Jan 19
1
[PATCH nbdkit] locks: Cache the plugin thread model.
...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"
+/* Note that the plugin's thread model cannot change after being
+ * loaded, so caching it here is safe....
2018 Jan 16
0
[PATCH nbdkit 1/3] plugins: Move locking to a new file.
...nt sockout)
{
int r;
- plugin_lock_connection ();
+ lock_connection ();
r = _handle_single_connection (sockin, sockout);
- plugin_unlock_connection ();
+ unlock_connection ();
return r;
}
@@ -740,12 +740,12 @@ negotiate_handshake (struct connection *conn)
{
int r;
- plugin_lock_request (conn);
+ lock_request (conn);
if (!newstyle)
r = _negotiate_handshake_oldstyle (conn);
else
r = _negotiate_handshake_newstyle (conn);
- plugin_unlock_request (conn);
+ unlock_request (conn);
return r;
}
@@ -1057,9 +1057,9 @@ recv_request_send_reply (struct connection *conn...
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 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
.../* plugins.c */
extern struct backend *plugin_register (size_t index, const char *filename,
@@ -465,8 +446,8 @@ extern void lock_init_thread_model (void);
extern const char *name_of_thread_model (int model);
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 (void);
+extern void unlock_request (void);
extern void lock_unload (void);
extern void unlock_unload (void);
diff --git a/server/backend.c b/server/backend.c
index 208c07b1..7a9a7ec8 100...
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.
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2:
- Fixed everything mentioned in the review.
Rich.
2018 Apr 12
3
[PATCH nbdkit 0/2] connections: Protect open and close callbacks with the request lock.
I'm fairly sure that these bugs which appear in the Python plugin:
https://bugzilla.redhat.com/show_bug.cgi?id=1566516
https://bugzilla.redhat.com/show_bug.cgi?id=1566522
are really bugs in the SERIALIZE_ALL_REQUESTS thread model. See
the first patch for the full explanation.
The second patch is a fix for a race condition which is probably
nudged into being by the first patch.
Now this
2020 Feb 11
1
Re: [PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...is fine.
> }
>
> static struct backend filter_functions = {
> diff --git a/server/locks.c b/server/locks.c
> index ef6726d8..d187b422 100644
> --- a/server/locks.c
> +++ b/server/locks.c
> @@ -91,8 +91,12 @@ unlock_connection (void)
> }
>
> void
> -lock_request (struct connection *conn)
> +lock_request (void)
> {
> + struct connection *conn = GET_CONN;
> +
> + assert (conn != NULL);
> +
Here's a site where we could exploit the macro guaranteeing a non-null
result.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc....
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are
called. This patch is in preparation for adding a second backend
subtype for filters.
Rich.
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.
...}
}
void
unlock_connection (void)
{
- if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) {
- debug ("release connection lock");
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS)
pthread_mutex_unlock (&connection_lock);
- }
}
void
lock_request (struct connection *conn)
{
- if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS) {
- debug ("acquire global request lock");
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS)
pthread_mutex_lock (&all_requests_lock);
- }
- if (thread_mod...
2019 Apr 24
0
[nbdkit PATCH 1/4] server: Check for pthread lock failures
...ck_connection (void)
{
- if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS)
- pthread_mutex_unlock (&connection_lock);
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS &&
+ pthread_mutex_unlock (&connection_lock))
+ abort ();
}
void
lock_request (struct connection *conn)
{
- if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS)
- pthread_mutex_lock (&all_requests_lock);
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS &&
+ pthread_mutex_lock (&all_requests_lock))
+ abort ();
-...
2019 Oct 03
0
[nbdkit PATCH 3/4] server: Close backends if a filter's .open fails
...nnections.c
+++ b/server/connections.c
@@ -360,7 +360,7 @@ free_connection (struct connection *conn)
* thread will be in the process of unloading it. The plugin.unload
* callback should always be called.
*/
- if (!quit && connection_get_handle (conn, 0)) {
+ if (!quit) {
lock_request (conn);
backend_close (backend, conn);
unlock_request (conn);
--
2.21.0
2013 Jul 26
0
[PATCH] ocfs2: dlm_request_all_locks() should deal with the status sent from target node
dlm_request_all_locks() should deal with the status sent from target
node if DLM_LOCK_REQUEST_MSG is sent successfully, or recovery master
will fall into endless loop, waiting for other nodes to send locks and
DLM_RECO_DATA_DONE_MSG to me.
NodeA NodeB
selected as recovery master...
2013 Aug 27
0
[patch 07/22] ocfs2: dlm_request_all_locks() should deal with the status sent from target node
From: Xue jiufei <xuejiufei at huawei.com>
Subject: ocfs2: dlm_request_all_locks() should deal with the status sent from target node
dlm_request_all_locks() should deal with the status sent from target node
if DLM_LOCK_REQUEST_MSG is sent successfully, or recovery master will fall
into endless loop, waiting for other nodes to send locks and
DLM_RECO_DATA_DONE_MSG to me.
NodeA NodeB
selected as recovery master...