search for: find_trans_by_cookie

Displaying 16 results from an estimated 16 matches for "find_trans_by_cookie".

2017 Dec 04
1
[nbdkit PATCH] nbd: Fix sporadic use-after-free
...t a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c index e79042c..9d40e87 100644 --- a/plugins/nbd/nbd.c +++ b/plugins/nbd/nbd.c @@ -227,6 +227,26 @@ nbd_mark_dead (struct handle *h) return -1; } +/* Find and remove the transaction corresponding to cookie from the list. */ +static struct transaction * +find_trans_by_cookie (struct handle *h, uint64_t cookie) +{ + struct transaction **ptr; + struct transaction *trans; + + nbd_lock (h); + ptr = &h->trans; + while ((trans = *ptr) != NULL) { + if (cookie == trans->u.cookie) + break; + ptr = &trans->next; + } + if (trans) + *ptr = tra...
2019 Apr 23
0
[nbdkit PATCH 7/7] nbd: Implement structured replies
...rleaving writes to server */ @@ -230,9 +233,10 @@ nbd_mark_dead (struct handle *h) return -1; } -/* Find and remove the transaction corresponding to cookie from the list. */ +/* Find and possibly remove the transaction corresponding to cookie + from the list. */ static struct transaction * -find_trans_by_cookie (struct handle *h, uint64_t cookie) +find_trans_by_cookie (struct handle *h, uint64_t cookie, bool remove) { struct transaction **ptr; struct transaction *trans; @@ -244,7 +248,7 @@ find_trans_by_cookie (struct handle *h, uint64_t cookie) break; ptr = &trans->next; } -...
2019 Apr 23
12
[nbdkit PATCH 0/7] Implement structured replies in nbd plugin
I'm hoping to implement .extents for the nbd plugin; this is a prerequisite. I'm not sure about patch 3 - if we like it, I'll squash it to 2, if we don't, I think we are okay just dropping it. I'm also wondering if we have to worry about malicious plugins that don't populate the entire .pread buffer in an effort to get nbdkit to expose portions of the heap; my patch 7 loses
2019 Apr 25
6
[nbdkit PATCH v2 0/5] structured replies/.extents for nbd plugin
Updated based on other changes that have happened in the meantime: - rely more on cleanup.h (throughout) - split structured read for easier review (patch 2 and 3 were combined in v1) - rely on nbdkit not leaking a server's partial answer (patch 3) - add tests (patch 5) - other bug fixes I found while testing it - drop EOVERFLOW patch for now; it will be separate once upstream NBD protocol
2019 May 25
1
[nbdkit PATCH] nbd: Rewrite thread passing to use semaphore rather than pipe
...fds[2]; - } u; + uint64_t cookie; + sem_t sem; void *buf; uint64_t offset; uint32_t count; @@ -182,6 +181,7 @@ struct handle { pthread_mutex_t trans_lock; /* Covers access to all fields below */ struct transaction *trans; + uint64_t unique; bool dead; }; @@ -264,7 +264,7 @@ find_trans_by_cookie (struct handle *h, uint64_t cookie, bool remove) ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&h->trans_lock); ptr = &h->trans; while ((trans = *ptr) != NULL) { - if (cookie == trans->u.cookie) + if (cookie == trans->cookie) break; ptr = &trans->next; } @...
2018 Dec 07
0
[nbdkit PATCH 6/5] nbd: More debug details
...= NBD_REPLY_MAGIC) return nbd_mark_dead (h); - nbdkit_debug ("received reply for cookie %#" PRIx64, rep.handle); + nbdkit_debug ("received reply for cookie %#" PRIx64 ", status %s", + rep.handle, name_of_nbd_error(be32toh (rep.error))); trans = find_trans_by_cookie (h, rep.handle); if (!trans) { nbdkit_error ("reply with unexpected cookie %#" PRIx64, rep.handle); diff --git a/plugins/nbd/Makefile.am b/plugins/nbd/Makefile.am index e998a28..9f08057 100644 --- a/plugins/nbd/Makefile.am +++ b/plugins/nbd/Makefile.am @@ -38,7 +38,8 @@ plugin_LTL...
2018 Dec 07
1
Re: [nbdkit PATCH 6/5] nbd: More debug details
...return nbd_mark_dead (h); > - nbdkit_debug ("received reply for cookie %#" PRIx64, rep.handle); > + nbdkit_debug ("received reply for cookie %#" PRIx64 ", status %s", > + rep.handle, name_of_nbd_error(be32toh (rep.error))); > trans = find_trans_by_cookie (h, rep.handle); > if (!trans) { > nbdkit_error ("reply with unexpected cookie %#" PRIx64, rep.handle); > diff --git a/plugins/nbd/Makefile.am b/plugins/nbd/Makefile.am > index e998a28..9f08057 100644 > --- a/plugins/nbd/Makefile.am > +++ b/plugins/nbd/Makefile.a...
2018 Dec 06
10
[PATCH nbdkit 0/5] protocol: Generate map functions from NBD protocol flags to printable strings.
With some crufty sed scripts we can generate functions that map from NBD protocol flags (eg. NBD_CMD_READ) to strings ("NBD_CMD_READ"). This works on GNU sed and with FreeBSD, also with GNU sed's --posix option, so I guess the sed code is POSIX-compatible. Rich.
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 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 May 30
0
[nbdkit PATCH 3/4] nbd: Use libnbd 0.1
...alue that cannot transmit over the wire, translate it to - ESHUTDOWN instead. */ - if (err == EPIPE || err == EBADMSG) - nbdkit_set_error (ESHUTDOWN); - return -1; -} - -/* Find and possibly remove the transaction corresponding to cookie - from the list. */ -static struct transaction * -find_trans_by_cookie (struct handle *h, uint64_t cookie, bool remove) -{ - struct transaction **ptr; - struct transaction *trans; - - ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&h->trans_lock); - ptr = &h->trans; - while ((trans = *ptr) != NULL) { - if (cookie == trans->cookie) - break; - ptr = &a...
2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
...alue that cannot transmit over the wire, translate it to - ESHUTDOWN instead. */ - if (err == EPIPE || err == EBADMSG) - nbdkit_set_error (ESHUTDOWN); - return -1; -} - -/* Find and possibly remove the transaction corresponding to cookie - from the list. */ -static struct transaction * -find_trans_by_cookie (struct handle *h, uint64_t cookie, bool remove) -{ - struct transaction **ptr; - struct transaction *trans; - - ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&h->trans_lock); - ptr = &h->trans; - while ((trans = *ptr) != NULL) { - if (cookie == trans->cookie) - break; - ptr = &a...
2020 Mar 19
1
[nbdkit PATCH] nbd: Drop nbd-standalone fallback
...alue that cannot transmit over the wire, translate it to - ESHUTDOWN instead. */ - if (err == EPIPE || err == EBADMSG) - nbdkit_set_error (ESHUTDOWN); - return -1; -} - -/* Find and possibly remove the transaction corresponding to cookie - from the list. */ -static struct transaction * -find_trans_by_cookie (struct handle *h, uint64_t cookie, bool remove) -{ - struct transaction **ptr; - struct transaction *trans; - - ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&h->trans_lock); - ptr = &h->trans; - while ((trans = *ptr) != NULL) { - if (cookie == trans->cookie) - break; - ptr = &a...
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
2018 Jan 16
9
[nbdkit PATCH 0/7] Initial implementation of FUA flag passthrough
Tested via: term1$ qemu-nbd -k $PWD/sock -t -f raw -x foo junk --trace=nbd_\* term2$ ./nbdkit -f -v -e bar nbd socket=$PWD/sock export=foo term3$ qemu-io -t none -f raw nbd://localhost:10809/bar --trace=nbd_\* and checking the traces to see that 'w 0 1' vs. 'w -f 0 1' was able to influence whether the FUA flag showed up at the server in term1. Still to go: figure out how to
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