Displaying 20 results from an estimated 24 matches for "unload_prevention_lock".
2019 Apr 24
0
[nbdkit PATCH 1/4] server: Check for pthread lock failures
...- if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS)
- pthread_mutex_lock (&conn->request_lock);
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS &&
+ pthread_mutex_lock (&conn->request_lock))
+ abort ();
- pthread_rwlock_rdlock (&unload_prevention_lock);
+ if (pthread_rwlock_rdlock (&unload_prevention_lock))
+ abort ();
}
void
unlock_request (struct connection *conn)
{
- pthread_rwlock_unlock (&unload_prevention_lock);
+ if (pthread_rwlock_unlock (&unload_prevention_lock))
+ abort ();
- if (thread_model <= NBDKIT_TH...
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...DAMAGE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "internal.h"
+
+static pthread_mutex_t connection_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t all_requests_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER;
+
+void
+lock_connection (void)
+{
+ int thread_model = plugin_thread_model ();
+
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) {
+ debug ("acquire connection lock");
+ pthread_mutex_lock (&connection_lock);
+ }
+}
+
+void
+...
2018 Jan 16
0
[PATCH nbdkit 1/3] plugins: Move locking to a new file.
...DAMAGE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "internal.h"
+
+static pthread_mutex_t connection_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t all_requests_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER;
+
+void
+lock_connection (void)
+{
+ int thread_model = plugin_thread_model ();
+
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) {
+ debug ("acquire connection lock");
+ pthread_mutex_lock (&connection_lock);
+ }
+}
+
+void
+...
2017 Nov 14
0
[PATCH 2/3] Avoid race conditions when nbdkit exits.
...}
diff --git a/src/plugins.c b/src/plugins.c
index d2d0b39..f5056d9 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -48,6 +48,7 @@
static pthread_mutex_t connection_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t all_requests_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER;
/* Maximum read or write request that we will handle. */
#define MAX_REQUEST_SIZE (64 * 1024 * 1024)
@@ -155,6 +156,11 @@ void
plugin_cleanup (void)
{
if (dl) {
+ /* Acquiring this lock prevents any plugin callbacks from running
+ * simultaneously.
+...
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
2017 Nov 14
7
[PATCH 0/3] Alternate way to avoid race conditions when nbdkit exits.
This fixes the race conditions for me, using the test described here:
https://www.redhat.com/archives/libguestfs/2017-September/msg00226.html
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 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.
...LIZE_REQUESTS) {
- debug ("acquire per-connection request lock");
+ if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS)
pthread_mutex_lock (connection_get_request_lock (conn));
- }
- debug ("acquire unload prevention lock");
pthread_rwlock_rdlock (&unload_prevention_lock);
}
void
unlock_request (struct connection *conn)
{
- debug ("release unload prevention lock");
pthread_rwlock_unlock (&unload_prevention_lock);
- if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS) {
- debug ("release per-connection request lock")...
2018 Jan 19
1
[PATCH nbdkit] locks: Cache the plugin thread model.
...that the plugin's thread model cannot change after being
+ * loaded, so caching it here is safe.
+ */
+static int thread_model;
+
static pthread_mutex_t connection_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t all_requests_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER;
void
-lock_connection (void)
+lock_init_thread_model (void)
{
- int thread_model = backend->thread_model (backend);
+ thread_model = backend->thread_model (backend);
+}
+void
+lock_connection (void)
+{
if (thread_model <= NBDKIT_THREAD_MODEL_SERIALI...
2020 Apr 28
2
[PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
...f (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS &&
pthread_mutex_lock (&all_requests_lock))
@@ -110,7 +110,7 @@ lock_request (void)
void
unlock_request ()
{
- GET_CONN;
+ struct connection *conn = threadlocal_get_conn ();
if (pthread_rwlock_unlock (&unload_prevention_lock))
abort ();
--
2.25.0
2018 Jan 17
14
[PATCH 0/9] Add filters to nbdkit.
The first three patches are identical to:
https://www.redhat.com/archives/libguestfs/2018-January/msg00079.html
"[PATCH nbdkit v2 0/3] Refactor plugin_* functions into a backend"
The rest of the patches add filters using the new filter API
previously described here:
https://www.redhat.com/archives/libguestfs/2018-January/msg00073.html
This needs a lot more testing -- and tests --
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
2018 Jan 19
16
[nbdkit PATCH v2 00/13] Add filters + FUA support to nbdkit
A combination of the work that both Rich and I have been doing
lately, where filters use only the new API with flags on every
command that the client can send over the wire (we can then
add support for more flags in nbdkit without having to add new
callbacks, as NBD adds more flags upstream).
Eric Blake (4):
protocol: Split flags from cmd field in requests
backend: Pass flags argument through
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...*plugin_register (const char *_filename, void *_dl, struct nbdkit_plugin *(*plugin_init) (void));
/* locks.c */
extern void lock_connection (void);
diff --git a/src/locks.c b/src/locks.c
index 6021356..62b2dd0 100644
--- a/src/locks.c
+++ b/src/locks.c
@@ -45,7 +45,7 @@ static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER;
void
lock_connection (void)
{
- int thread_model = plugin_thread_model ();
+ int thread_model = backend->thread_model (backend);
if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) {
debug ("acquire connection lock");
@@ -56,7...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...*plugin_register (const char *_filename, void *_dl, struct nbdkit_plugin *(*plugin_init) (void));
/* locks.c */
extern void lock_connection (void);
diff --git a/src/locks.c b/src/locks.c
index 6021356..62b2dd0 100644
--- a/src/locks.c
+++ b/src/locks.c
@@ -45,7 +45,7 @@ static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER;
void
lock_connection (void)
{
- int thread_model = plugin_thread_model ();
+ int thread_model = backend->thread_model (backend);
if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) {
debug ("acquire connection lock");
@@ -56,7...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...*plugin_register (const char *_filename, void *_dl, struct nbdkit_plugin *(*plugin_init) (void));
/* locks.c */
extern void lock_connection (void);
diff --git a/src/locks.c b/src/locks.c
index 6021356..62b2dd0 100644
--- a/src/locks.c
+++ b/src/locks.c
@@ -45,7 +45,7 @@ static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER;
void
lock_connection (void)
{
- int thread_model = plugin_thread_model ();
+ int thread_model = backend->thread_model (backend);
if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) {
debug ("acquire connection lock");
@@ -56,7...
2018 Jan 14
10
[PATCH nbdkit INCOMPLETE 0/6] Introduce filters to nbdkit.
This patch isn't complete (patch 6/6 isn't finished) so it's just for
discussion, although it does compile and run.
This introduces to nbdkit a concept of "filters" which can be placed
in front of plugins to modify their behaviour. Some examples where
you might use filters:
* Serve a subset of the data, such as (offset, range) or a
single partition from a disk image.
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.