Displaying 20 results from an estimated 49 matches for "plugin_close".
2019 Oct 03
2
Re: [nbdkit PATCH 3/4] server: Close backends if a filter's .open fails
$ ./nbdkit -s memory 1M < fuzzing/testcase_dir/newstyle-cflags
NBDMAGICIHAVEOPTnbdkit: plugins.c:274: plugin_close: Assertion `connection_get_handle (conn, 0)' failed.
Aborted (core dumped)
git bisect implicates this patch:
2f80ce1209d5898cb9a567c0b29e7736ff4d03eb is the first bad commit
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtu...
2016 Sep 27
1
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
..., the following
calls are neither locked against each other nor are they locked against
client requests:
plugin_register (const char *_filename,
plugin_cleanup (void)
plugin_config (const char *key, const char *value)
plugin_config_complete (void)
plugin_open (struct connection *conn, int readonly)
plugin_close (struct connection *conn)
plugin_get_size (struct connection *conn)
plugin_can_write (struct connection *conn)
plugin_can_flush (struct connection *conn)
plugin_is_rotational (struct connection *conn)
plugin_can_trim (struct connection *conn)
That means dumping the plugin-internal data on connecti...
2016 Sep 26
2
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
...#7 0x00007ffff6fbad43 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#8 0x00007ffff7033577 in PyEval_CallObjectWithKeywords () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#9 0x00007ffff73f0af0 in py_close (handle=0x625338) at python.c:234
#10 0x0000000000405803 in plugin_close (conn=conn@entry=0x7fffe8000910) at plugins.c:377
#11 0x00000000004037ec in free_connection (conn=0x7fffe8000910) at connections.c:147
#12 0x0000000000404476 in _handle_single_connection (sockout=<optimized out>, sockin=<optimized out>) at connections.c:99
#13 handle_single_connection (...
2017 Sep 28
0
Re: nbdkit 1.1.15 -- test-python failure
...n strlen () from /lib64/libc.so.6
#1 0x00007f67a884f465 in fputs () from /lib64/libc.so.6
#2 0x0000000000406715 in prologue (type=0x409928 "debug") at errors.c:54
#3 0x000000000040685d in nbdkit_debug (fs=fs@entry=0x40ace6 "close")
at errors.c:91
#4 0x00000000004077d9 in plugin_close (conn=conn@entry=0x7f679c000910)
at plugins.c:386
#5 0x0000000000404de3 in free_connection (conn=0x7f679c000910)
at connections.c:228
#6 0x00000000004059fd in _handle_single_connection (sockout=<optimized out>,
sockin=<optimized out>) at connections.c:179
#7 handle_singl...
2017 Nov 14
0
[PATCH 2/3] Avoid race conditions when nbdkit exits.
...+), 9 deletions(-)
diff --git a/src/connections.c b/src/connections.c
index 46609f0..0cbf54a 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -224,8 +224,14 @@ free_connection (struct connection *conn)
pthread_mutex_destroy (&conn->request_lock);
- if (conn->handle)
- plugin_close (conn);
+ /* Don't call the plugin again if quit has been set because the main
+ * thread will be in the process of unloading it. The plugin.unload
+ * callback should always be called.
+ */
+ if (!quit) {
+ if (conn->handle)
+ plugin_close (conn);
+ }
free (conn);
}...
2018 Jul 01
2
[PATCH nbdkit] Add Tcl plugin, for writing plugins in Tcl.
...[open $file $flags]
+
+ # Stop Tcl from trying to convert to and from UTF-8.
+ fconfigure $fh -translation binary
+
+ # We can return any Tcl object as the handle. In this
+ # plugin it's convenient to return the file handle.
+ return $fh
+}
+
+# Close a client connection.
+proc plugin_close {fh} {
+ close $fh
+}
+
+proc get_size {fh} {
+ global file
+
+ return [file size $file]
+}
+
+proc pread {fh count offset} {
+ seek $fh $offset
+ return [read $fh $count]
+}
+
+proc pwrite {fh buf offset} {
+ seek $fh $offset
+ puts -nonewline $fh $buf
+}
diff --git a/plugins/...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
..."%s.%d", backend->name (backend), nworkers) < 0) {
perror ("asprintf");
set_status (conn, -1);
free (worker);
@@ -340,7 +342,7 @@ free_connection (struct connection *conn)
*/
if (!quit) {
if (conn->handle)
- plugin_close (conn);
+ backend->close (backend, conn);
}
free (conn);
@@ -352,7 +354,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
uint16_t eflags = NBD_FLAG_HAS_FLAGS;
int fl;
- fl = plugin_can_write (conn);
+ fl = backend->can_write (backend, conn);
if (fl == -...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
..."%s.%d", backend->name (backend), nworkers) < 0) {
perror ("asprintf");
set_status (conn, -1);
free (worker);
@@ -340,7 +342,7 @@ free_connection (struct connection *conn)
*/
if (!quit) {
if (conn->handle)
- plugin_close (conn);
+ backend->close (backend, conn);
}
free (conn);
@@ -352,7 +354,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
uint16_t eflags = NBD_FLAG_HAS_FLAGS;
int fl;
- fl = plugin_can_write (conn);
+ fl = backend->can_write (backend, conn);
if (fl == -...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
..."%s.%d", backend->name (backend), nworkers) < 0) {
perror ("asprintf");
set_status (conn, -1);
free (worker);
@@ -340,7 +342,7 @@ free_connection (struct connection *conn)
*/
if (!quit) {
if (conn->handle)
- plugin_close (conn);
+ backend->close (backend, conn);
}
free (conn);
@@ -352,7 +354,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
uint16_t eflags = NBD_FLAG_HAS_FLAGS;
int fl;
- fl = plugin_can_write (conn);
+ fl = backend->can_write (backend, conn);
if (fl == -...
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2:
- Fixed everything mentioned in the review.
Rich.
2016 Sep 26
0
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
...f6fbad43 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
> #8 0x00007ffff7033577 in PyEval_CallObjectWithKeywords () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
> #9 0x00007ffff73f0af0 in py_close (handle=0x625338) at python.c:234
> #10 0x0000000000405803 in plugin_close (conn=conn@entry=0x7fffe8000910) at plugins.c:377
> #11 0x00000000004037ec in free_connection (conn=0x7fffe8000910) at connections.c:147
> #12 0x0000000000404476 in _handle_single_connection (sockout=<optimized out>, sockin=<optimized out>) at connections.c:99
> #13 handle_sing...
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.
2019 Oct 03
0
Re: [nbdkit PATCH 3/4] server: Close backends if a filter's .open fails
On 10/3/19 2:38 PM, Richard W.M. Jones wrote:
>
> $ ./nbdkit -s memory 1M < fuzzing/testcase_dir/newstyle-cflags
> NBDMAGICIHAVEOPTnbdkit: plugins.c:274: plugin_close: Assertion `connection_get_handle (conn, 0)' failed.
> Aborted (core dumped)
>
> git bisect implicates this patch:
>
> 2f80ce1209d5898cb9a567c0b29e7736ff4d03eb is the first bad commit
Yep, I see it. More patches coming (we need to better track when .open
and .prepare have su...
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.
2000 Dec 27
1
ao_arts
Hi,
I've written an ao plugin for aRts, the soundserver that comes with KDE.
Any chance of including this in the ao distribution ? Pretty please ? :)
Sources and patches attached. This is a very simple plugin because it
uses the easy-to-use 'artsc' C wrapper that aRts installs.
configure.in.diff is for ao/configure.in
Makefile.am.diff is for ao/src/plugins/Makefile.am
Makefile.am
2019 Sep 19
0
[nbdkit PATCH 1/4] server: Fix regression for NBD_OPT_INFO before NBD_OPT_GO
...LL);
- b->next->close (b->next, conn);
+ backend_close (b->next, conn);
}
/* The next_functions structure contains pointers to backend
diff --git a/server/plugins.c b/server/plugins.c
index 9b44c548..727fb0e0 100644
--- a/server/plugins.c
+++ b/server/plugins.c
@@ -273,12 +273,8 @@ plugin_close (struct backend *b, struct connection *conn)
assert (connection_get_handle (conn, 0));
- debug ("close");
-
if (p->plugin.close)
p->plugin.close (connection_get_handle (conn, 0));
-
- backend_set_handle (b, conn, NULL);
}
static int64_t
diff --git a/server/protocol...
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...ction (void);
-extern void plugin_lock_request (struct connection *conn);
-extern void plugin_unlock_request (struct connection *conn);
-extern bool plugin_is_parallel (void);
extern int plugin_errno_is_preserved (void);
extern int plugin_open (struct connection *conn, int readonly);
extern void plugin_close (struct connection *conn);
@@ -169,6 +165,14 @@ extern int plugin_flush (struct connection *conn);
extern int plugin_trim (struct connection *conn, uint32_t count, uint64_t offset);
extern int plugin_zero (struct connection *conn, uint32_t count, uint64_t offset, int may_trim);
+/* locks.c */
+...
2018 Jan 16
0
[PATCH nbdkit 1/3] plugins: Move locking to a new file.
...ction (void);
-extern void plugin_lock_request (struct connection *conn);
-extern void plugin_unlock_request (struct connection *conn);
-extern bool plugin_is_parallel (void);
extern int plugin_errno_is_preserved (void);
extern int plugin_open (struct connection *conn, int readonly);
extern void plugin_close (struct connection *conn);
@@ -169,6 +165,14 @@ extern int plugin_flush (struct connection *conn);
extern int plugin_trim (struct connection *conn, uint32_t count, uint64_t offset);
extern int plugin_zero (struct connection *conn, uint32_t count, uint64_t offset, int may_trim);
+/* locks.c */
+...
2020 Sep 21
0
[nbdkit PATCH v3 06/14] api: Add .export_description
....c b/server/plugins.c
index 69835d32..010595c7 100644
--- a/server/plugins.c
+++ b/server/plugins.c
@@ -170,6 +170,7 @@ plugin_dump_fields (struct backend *b)
HAS (open);
HAS (close);
+ HAS (export_description);
HAS (get_size);
HAS (can_write);
HAS (can_flush);
@@ -369,6 +370,17 @@ plugin_close (struct backend *b, void *handle)
conn->exportname = NULL;
}
+static const char *
+plugin_export_description (struct backend *b, void *handle)
+{
+ struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
+
+ if (p->plugin.export_description)
+ return p->plugi...
2017 Nov 17
0
[nbdkit PATCH 6/6] Add --threads option for supporting true parallel requests
...ction (void);
extern void plugin_lock_request (struct connection *conn);
extern void plugin_unlock_request (struct connection *conn);
+extern bool plugin_is_parallel (void);
extern int plugin_errno_is_preserved (void);
extern int plugin_open (struct connection *conn, int readonly);
extern void plugin_close (struct connection *conn);
diff --git a/src/main.c b/src/main.c
index c9f08ab..cc5e9e3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -84,6 +84,7 @@ int readonly; /* -r */
char *run; /* --run */
int listen_stdin; /* -s */
const char *selinux_labe...