Displaying 18 results from an estimated 18 matches for "nbdplug_close_handle".
2020 Mar 28
0
[nbdkit PATCH v2] nbd: Avoid stuck poll() in nbdplug_close_handle()
...e <eblake@redhat.com>
---
plugins/nbd/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c
index ba1e7188..0ea2a4a2 100644
--- a/plugins/nbd/nbd.c
+++ b/plugins/nbd/nbd.c
@@ -532,7 +532,7 @@ nbdplug_open (int readonly)
static void
nbdplug_close_handle (struct handle *h)
{
- if (nbd_shutdown (h->nbd, 0) == -1)
+ if (nbd_aio_disconnect (h->nbd, 0) == -1)
nbdkit_debug ("failed to clean up handle: %s", nbd_get_error ());
if ((errno = pthread_join (h->reader, NULL)))
nbdkit_debug ("failed to join reader thread:...
2020 Jul 01
0
[PATCH nbdkit 8/9] nbd: Fix shared=true so it creates background thread after fork.
...The fix is to move this work to .after_fork.
---
plugins/nbd/nbd.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c
index 05f78777..91ed91e0 100644
--- a/plugins/nbd/nbd.c
+++ b/plugins/nbd/nbd.c
@@ -109,7 +109,7 @@ static void nbdplug_close_handle (struct handle *h);
static void
nbdplug_unload (void)
{
- if (shared)
+ if (shared && shared_handle)
nbdplug_close_handle (shared_handle);
free (sockname);
free (tls_certificates);
@@ -266,8 +266,15 @@ nbdplug_config_complete (void)
}
nbd_close (nbd);
}
+ retur...
2020 Mar 19
2
Re: Anyone seen build hangs (esp armv7, s390x) in Fedora?
...09b0) at nbd.c:323
#3 0x00007fabc069d472 in start_thread () from /lib64/libpthread.so.0
#4 0x00007fabc05cc063 in clone () from /lib64/libc.so.6
Thread 2 (Thread 0x7fabbfcf8700 (LWP 3955793)):
#0 0x00007fabc069eab7 in __pthread_clockjoin_ex () from /lib64/libpthread.so.0
#1 0x00007fabc090af2b in nbdplug_close_handle (h=0x5584020e09b0) at nbd.c:538
#2 0x00005583f90caee0 in backend_close (b=<optimized out>) at backend.c:247
#3 0x00005583f90cdbf1 in free_connection (conn=0x5584020df890) at connections.c:359
#4 handle_single_connection (sockin=<optimized out>, sockout=<optimized out>) at conne...
2019 Jun 18
0
[nbdkit PATCH] Experiment: nbd: Use ppoll() instead of pipe-to-self
...once initialized */
struct nbd_handle *nbd;
int fd; /* Cache of nbd_aio_get_fd */
- int fds[2]; /* Pipe for kicking the reader thread */
bool readonly;
pthread_t reader;
@@ -105,6 +105,15 @@ static char *tls_psk;
static struct handle *nbdplug_open_handle (int readonly);
static void nbdplug_close_handle (struct handle *h);
+/* Original signal mask, with SIGUSR1 unblocked */
+static sigset_t origmask;
+
+/* No-op signal handler for interrupting ppoll on SIGUSR1 */
+static void
+nbdplug_sigusr1 (int sig)
+{
+}
+
static void
nbdplug_unload (void)
{
@@ -195,10 +204,30 @@ nbdplug_config (const char...
2020 Mar 27
4
[nbdkit PATCH 0/2] Improve shutdown race in nbd plugin
I still need more soak time on testing, to see whether I can:
a) reproduce the hang with patch 2 not applied
b) feel confident that patch 2 is sufficient to fix the race, or else
determine that I also need to augment the loop condition in the reader
thread to additionally break out of the loop when the pipe-to-self
sees EOF even when nbd_aio_is_dead() has not yet been satisfied
I'm also
2020 Mar 27
0
[nbdkit PATCH 2/2] nbd: Reorder cleanup to avoid getting stuck in poll()
...might also need to break out of the reader loop
when read() returns 0.
plugins/nbd/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c
index e5b8f338..23a7da06 100644
--- a/plugins/nbd/nbd.c
+++ b/plugins/nbd/nbd.c
@@ -537,10 +537,10 @@ nbdplug_close_handle (struct handle *h)
{
if (nbd_shutdown (h->nbd, 0) == -1)
nbdkit_debug ("failed to clean up handle: %s", nbd_get_error ());
+ close (h->fds[1]);
if ((errno = pthread_join (h->reader, NULL)))
nbdkit_debug ("failed to join reader thread: %m");
close (h...
2019 Jul 30
1
[PATCH nbdkit] nbd: Update for libnbd 0.9.6.
...okie %" PRId64 " started by state machine", cookie);
+ trans->cookie = cookie;
if (write (h->fds[1], &c, 1) != 1 && errno != EAGAIN)
nbdkit_debug ("failed to kick reader thread: %m");
@@ -504,7 +510,7 @@ nbdplug_open (int readonly)
static void
nbdplug_close_handle (struct handle *h)
{
- if (nbd_shutdown (h->nbd) == -1)
+ if (nbd_shutdown (h->nbd, 0) == -1)
nbdkit_debug ("failed to clean up handle: %s", nbd_get_error ());
if ((errno = pthread_join (h->reader, NULL)))
nbdkit_debug ("failed to join reader thread: %m"...
2020 Mar 27
1
Re: [nbdkit PATCH 2/2] nbd: Reorder cleanup to avoid getting stuck in poll()
...gt; when read() returns 0.
>
> plugins/nbd/nbd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c
> index e5b8f338..23a7da06 100644
> --- a/plugins/nbd/nbd.c
> +++ b/plugins/nbd/nbd.c
> @@ -537,10 +537,10 @@ nbdplug_close_handle (struct handle *h)
> {
> if (nbd_shutdown (h->nbd, 0) == -1)
> nbdkit_debug ("failed to clean up handle: %s", nbd_get_error ());
> + close (h->fds[1]);
> if ((errno = pthread_join (h->reader, NULL)))
> nbdkit_debug ("failed to join reader...
2020 Jul 01
15
[PATCH nbdkit 0/9] nbd: Implement command= and socket-fd= parameters.
I fixed the deadlock - turned out to be an actual bug in the nbd
plugin (see patch 8).
I changed the command syntax so it's now:
nbdkit nbd command=qemu arg=-f arg=qcow2 arg=/path/to/disk.qcow2
Nir wrote:
18:08 < nsoffer> rwmjones: regarding the nbd proxy patches, did you have specific flow that help us?
18:08 < nsoffer> rwmjones: or this is just a way to support qcow2 in the
2019 Jul 01
0
[nbdkit PATCH 2/2] nbd: Use nbdkit aio_*_notify variants
...lize transaction mutex: %m");
- goto err;
- }
if ((errno = pthread_create (&h->reader, NULL, nbdplug_reader, h))) {
nbdkit_error ("failed to initialize reader thread: %m");
- pthread_mutex_destroy (&h->trans_lock);
goto err;
}
@@ -562,7 +518,6 @@ nbdplug_close_handle (struct handle *h)
close (h->fds[0]);
close (h->fds[1]);
nbd_close (h->nbd);
- pthread_mutex_destroy (&h->trans_lock);
free (h);
}
@@ -717,7 +672,8 @@ nbdplug_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
assert (!flags);
nbdplug_prepare (&am...
2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
...me;
static const char *hostname;
static const char *port;
-/* Human-readable server description */
-static char *servname;
-
/* Name of export on remote server, default '', ignored for oldstyle */
static const char *export;
@@ -117,7 +106,6 @@ nbdplug_unload (void)
if (shared)
nbdplug_close_handle (shared_handle);
free (sockname);
- free (servname);
}
/* Called for each key=value passed on the command line. This plugin
@@ -170,8 +158,6 @@ nbdplug_config (const char *key, const char *value)
static int
nbdplug_config_complete (void)
{
- int r;
-
if (sockname) {
struct socka...
2019 Jun 02
5
[nbdkit PATCH v2 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.2-1 is now available in Fedora 29/30 updates-testing,
although it was not compiled against libxml2 so it lacks uri support
(I ended up testing patch 4 with a self-built libnbd).
Diffs since v1 - rebase to master, bump from libnbd 0.1 to 0.1.2, add
URI support, better timing results
Still not done - patch 5 needs associated tests
Eric Blake (5):
nbd: Check for libnbd
nbd:
2019 Jun 12
8
[nbdkit PATCH v3 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.4-1 is now available in Fedora 29/30 updates testing.
Diffs since v2 - rebase to master, bump from libnbd 0.1.2 to 0.1.3+,
add tests to TLS usage which flushed out the need to turn relative
pathnames into absolute, doc tweaks
Now that the testsuite covers TLS and libnbd has been fixed to provide
the things I found lacking when developing v2, I'm leaning towards
pushing this on
2020 Aug 28
4
[nbdkit PATCH 0/3] .list_exports in nbd plugin
Another series on top of my exportname filter, marking off another
todo bullet point. With this, you can now use the NBD plugin as a
transparent passthrough of all export names served by the remote
server in both directions (list advertisement server to client, and
export name from client to server).
Eric Blake (3):
nbd: Implement .default_export, .export_description
nbd: Add
2019 May 30
5
[nbdkit PATCH 0/4] Play with libnbd for nbdkit-add
Patch 1 played with an early draft of Rich's Fedora 30 libnbd package:
https://bugzilla.redhat.com/show_bug.cgi?id=1713767#c17
Note that comment 21 provides a newer package 0.1.1-1 with a different
API; and that libnbd has more unreleased API changes in the pipeline
(whether that will be called 0.2 or 0.1.2); so we'll have to tweak
things based on what is actually available in distros.
2019 Jul 01
3
[nbdkit PATCH 0/2] Use new libnbd _notify functions
I'm not observing any noticeable performance differences, but I'm
liking the diffstat. I can't push this patch until we release a new
libnbd version with the _notify API addition, but am posting it now
for playing with things.
Eric Blake (2):
nbd: Move transaction info from heap to stack
nbd: Use nbdkit aio_*_notify variants
plugins/nbd/nbd.c | 217
2019 May 30
0
[nbdkit PATCH 3/4] nbd: Use libnbd 0.1
...close (h->fd);
+ close (h->fds[0]);
+ close (h->fds[1]);
+ nbdkit_error ("failure while creating nbd handle: %s", nbd_get_error ());
+ if (h->nbd)
+ nbd_close (h->nbd);
free (h);
return NULL;
}
@@ -1128,14 +454,13 @@ nbdplug_open (int readonly)
static void
nbdplug_close_handle (struct handle *h)
{
- if (!h->dead) {
- nbdplug_request_raw (h, 0, NBD_CMD_DISC, 0, 0, 0, NULL);
- shutdown (h->fd, SHUT_WR);
- }
+ if (nbd_shutdown (h->nbd) == -1)
+ nbdkit_debug ("failed to clean up handle: %s", nbd_get_error ());
if ((errno = pthread_join (h-&...
2020 Sep 21
18
[nbdkit PATCH v3 00/14] exportname filter
It's been several weeks since I posted v2 (I got distracted by
improving libnbd to better test things, which in turn surfaced some
major memory leak problems in nbdsh that are now fixed). Many of the
patches are minor rebases from v2, with the biggest changes being
fallout from:
- patch 2: rename nbdkit_add_default_export to nbdkit_use_default_export
- overall: this missed 1.22, so update