Displaying 20 results from an estimated 33 matches for "nbd_unlocked_aio_block_status".
2019 May 28
0
[libnbd PATCH 2/4] api: Rearrange flags argument to block_status
...uint64_t count, uint64_t offset, uint32_t flags,
- void *data,
- extent_fn extent)
+ uint64_t count, uint64_t offset,
+ void *data, extent_fn extent, uint32_t flags)
{
int64_t ch;
- ch = nbd_unlocked_aio_block_status (h, count, offset, flags, data, extent);
+ ch = nbd_unlocked_aio_block_status (h, count, offset, data, extent, flags);
if (ch == -1)
return -1;
@@ -371,9 +370,8 @@ nbd_unlocked_aio_zero (struct nbd_handle *h,
int64_t
nbd_unlocked_aio_block_status (struct nbd_handle *h,...
2019 Jun 18
0
[libnbd PATCH 4/8] states: Prepare for read callback
...ffset = offset;
cmd->count = count;
cmd->data = data;
- cmd->extent_fn = extent;
+ if (cb)
+ cmd->cb = *cb;
/* If structured replies were negotiated then we trust the server to
* send back sufficient data to cover the whole buffer. It's tricky
@@ -360,6 +361,8 @@ nbd_unlocked_aio_block_status (struct nbd_handle *h,
void *data, extent_fn extent,
uint32_t flags)
{
+ struct command_cb cb = { .opaque = data, .fn.extent = extent, };
+
if (!h->structured_replies) {
set_error (ENOTSUP, "server does not support st...
2020 Sep 07
0
[libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...uint64_t count, uint64_t offset,
- nbd_extent_callback extent,
+ nbd_extent_callback *extent,
uint32_t flags)
{
int64_t cookie;
+ nbd_completion_callback c = NBD_NULL_COMPLETION;
- cookie = nbd_unlocked_aio_block_status (h, count, offset, extent,
- NBD_NULL_COMPLETION, flags);
+ cookie = nbd_unlocked_aio_block_status (h, count, offset, extent, &c, flags);
if (cookie == -1)
return -1;
@@ -262,10 +262,10 @@ nbd_internal_command_common (struct nbd_handle *h,
int...
2019 May 22
0
[libnbd PATCH v3 1/7] lib: Refactor command_common() to do more common work
...)
- return -1;
- if (nbd_internal_run (conn->h, conn, cmd_issue) == -1)
- return -1;
-
- return cmd->handle;
+ return nbd_internal_command_common (conn, flags, NBD_CMD_WRITE_ZEROES, offset,
+ count, NULL, 0, NULL);
}
int64_t
@@ -474,8 +436,6 @@ nbd_unlocked_aio_block_status (struct nbd_connection *conn,
int64_t id,
extent_fn extent)
{
- struct command_in_flight *cmd;
-
if (!conn->structured_replies) {
set_error (ENOTSUP, "server does not support structured replies");
return -1;...
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...int
nbd_unlocked_block_status (struct nbd_handle *h,
uint64_t count, uint64_t offset,
- void *user_data, extent_fn extent, uint32_t flags)
+ extent_fn extent, void *user_data, uint32_t flags)
{
int64_t ch;
- ch = nbd_unlocked_aio_block_status (h, count, offset, user_data, extent,
+ ch = nbd_unlocked_aio_block_status (h, count, offset, extent, user_data,
flags);
if (ch == -1)
return -1;
@@ -257,10 +257,10 @@ nbd_unlocked_aio_pread (struct nbd_handle *h, void *buf,
int64_t
nbd_unlocked_aio...
2020 Sep 07
4
[libnbd PATCH 0/2] Fix memory leak with closures
As promised in my earlier thread on libnbd completion callback question.
Eric Blake (2):
generator: Refactor handling of closures in unlocked functions
generator: Free closures on failure
docs/libnbd.pod | 2 +-
generator/C.ml | 48 +++++++++++------
generator/C.mli | 1 +
lib/debug.c | 7 +--
lib/opt.c | 31 ++++++-----
2019 May 22
0
[libnbd PATCH v2 1/5] lib: Refactor state event into command_common
...+453,6 @@ nbd_unlocked_aio_zero (struct nbd_connection *conn,
cmd = command_common (conn, flags, NBD_CMD_WRITE_ZEROES, offset, count, NULL);
if (!cmd)
return -1;
- if (nbd_internal_run (conn->h, conn, cmd_issue) == -1)
- return -1;
return cmd->handle;
}
@@ -505,8 +495,5 @@ nbd_unlocked_aio_block_status (struct nbd_connection *conn,
cmd->extent_fn = extent;
cmd->extent_id = id;
- if (nbd_internal_run (conn->h, conn, cmd_issue) == -1)
- return -1;
-
return cmd->handle;
}
--
2.20.1
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE **
This is the generator change as discussed on the list already.
The Python and OCaml bindings are not yet done.
It passes all [C only] tests and valgrind.
Note that nbd_add_close_callback is inconsistent with other closure
types because it passes the user_data parameter after the function.
(This is not caused by the current patch, it was already
inconsistent). We decided that
2020 Sep 04
0
[libnbd PATCH 2/2] api: Add STRICT_BOUNDS to nbd_set_strict_mode
...return -1;
+ }
+
+ if (offset > h->exportsize || offset + count > h->exportsize) {
+ set_error (ENOSPC, "request out of bounds");
+ return -1;
+ }
}
return nbd_internal_command_common (h, flags, NBD_CMD_WRITE_ZEROES, offset,
@@ -504,9 +566,16 @@ nbd_unlocked_aio_block_status (struct nbd_handle *h,
}
}
- if (count == 0) { /* NBD protocol forbids this. */
- set_error (EINVAL, "count cannot be 0");
- return -1;
+ if (h->strict & LIBNBD_STRICT_BOUNDS) {
+ if (count == 0) { /* NBD protocol forbids this. */
+...
2020 Sep 11
0
[libnbd PATCH v2 5/5] api: Add STRICT_BOUNDS/ZERO_SIZE to nbd_set_strict_mode
...turn -1;
- }
-
SET_CALLBACK_TO_NULL (*completion);
return nbd_internal_command_common (h, flags, NBD_CMD_WRITE_ZEROES, offset,
- count, NULL, &cb);
+ count, ENOSPC, NULL, &cb);
}
int64_t
@@ -478,13 +482,8 @@ nbd_unlocked_aio_block_status (struct nbd_handle *h,
}
}
- if (count == 0) { /* NBD protocol forbids this. */
- set_error (EINVAL, "count cannot be 0");
- return -1;
- }
-
SET_CALLBACK_TO_NULL (*extent);
SET_CALLBACK_TO_NULL (*completion);
return nbd_internal_command_common (h, fl...
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...er_data, };
+ struct command_cb cb = { .completion = completion, .user_data = user_data, };
if (nbd_unlocked_read_only (h) == 1) {
set_error (EINVAL, "server does not support write operations");
@@ -495,7 +504,7 @@ nbd_unlocked_aio_zero_callback (struct nbd_handle *h,
int64_t
nbd_unlocked_aio_block_status (struct nbd_handle *h,
uint64_t count, uint64_t offset,
- extent_fn extent, void *user_data,
+ nbd_extent_callback extent, void *user_data,
uint32_t flags)
{
return nbd_un...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...status (struct nbd_handle *h,
uint64_t count, uint64_t offset,
- nbd_extent_callback extent, void *user_data,
+ nbd_extent_callback extent,
uint32_t flags)
{
int64_t cookie;
- cookie = nbd_unlocked_aio_block_status (h, count, offset, extent, user_data,
- NULL, NULL, flags);
+ cookie = nbd_unlocked_aio_block_status (h, count, offset, extent,
+ NBD_NULL_CALLBACK(completion), flags);
if (cookie == -1)
return -1;
@@ -257,...
2020 Sep 04
4
[RFC libnbd PATCH 0/2] Add knobs for client- vs. server-side validation
We have been inconsistent on how much we reject client-side without
even consulting the server, vs. how much we depend on the server to
detect failure (even if our request can be deemed undefined per NBD
protocol). I'd like to change it so that by default, we reject as
much as we can client-side for less traffic, but where the user can
also change things on the fly for server-side integration
2019 May 22
10
[libnbd PATCH v2 0/5] Avoid deadlock with in-flight commands
On v1, we discussed whether cmds_to_issue needed to be a list, since
it never had more than one element. I played with the idea of making
it a list, and allowing the client to queue up new commands regardless
of whether the state machine is currently in READY. I also polished up
the tmp demo into a bit more full-fledged example file, worth
including since it also let me discover a hard-to-hit race
2019 May 28
6
[RFC libnbd PATCH 0/4] Add CMD_FLAG_DF support
RFC because this is an API break, but we haven't declared stable API
yet. If we like it, I'm working on using libnbd to implement the
nbdkit-nbd plugin; knowing whether it is API version 0.1 or 0.2 will
be useful. I also dabbled with allowing optional parameters in python,
although my OCaml is weak enough that there may be cleaner ways to
approach that.
Eric Blake (4):
api: Add flags
2020 Sep 07
0
[libnbd PATCH 2/2] generator: Free closures on failure
...p;cb);
}
@@ -457,6 +477,7 @@ nbd_unlocked_aio_zero (struct nbd_handle *h,
return -1;
}
+ SET_CALLBACK_TO_NULL (*completion);
return nbd_internal_command_common (h, flags, NBD_CMD_WRITE_ZEROES, offset,
count, NULL, &cb);
}
@@ -493,6 +514,8 @@ nbd_unlocked_aio_block_status (struct nbd_handle *h,
return -1;
}
+ SET_CALLBACK_TO_NULL (*extent);
+ SET_CALLBACK_TO_NULL (*completion);
return nbd_internal_command_common (h, flags, NBD_CMD_BLOCK_STATUS, offset,
count, NULL, &cb);
}
diff --git a/tests/closure-lifetimes...
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...h,
int
nbd_unlocked_block_status (struct nbd_handle *h,
uint64_t count, uint64_t offset,
- void *data, extent_fn extent, uint32_t flags)
+ void *user_data, extent_fn extent, uint32_t flags)
{
int64_t ch;
- ch = nbd_unlocked_aio_block_status (h, count, offset, data, extent, flags);
+ ch = nbd_unlocked_aio_block_status (h, count, offset, user_data, extent,
+ flags);
if (ch == -1)
return -1;
@@ -159,8 +160,8 @@ nbd_unlocked_block_status (struct nbd_handle *h,
int64_t
nbd_internal_command_...
2019 Aug 13
0
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...{
int64_t cookie;
- cookie = nbd_unlocked_aio_zero (h, count, offset, flags);
+ cookie = nbd_unlocked_aio_zero (h, count, offset, NULL, NULL, flags);
if (cookie == -1)
return -1;
@@ -152,7 +153,7 @@ nbd_unlocked_block_status (struct nbd_handle *h,
int64_t cookie;
cookie = nbd_unlocked_aio_block_status (h, count, offset, extent, user_data,
- flags);
+ NULL, NULL, flags);
if (cookie == -1)
return -1;
@@ -254,18 +255,10 @@ nbd_internal_command_common (struct nbd_handle *h,
int64_t
nbd_unlocked_aio_pread...
2019 May 22
12
[libnbd PATCH v3 0/7] Avoid deadlock with in-flight commands
Since v2:
- rebase to Rich's new API calls
- more refactoring in patch 1 (retitled)
- new patches 3 and 4
- fix data corruption in patch 6 (was 4)
- more tweaks to the reproducer example (including using new API from 3)
Eric Blake (7):
lib: Refactor command_common() to do more common work
commands: Allow for a command queue
commands: Expose FIFO ordering of server completions
2020 Sep 04
0
[libnbd PATCH 1/2] api: Add nbd_set_strict_mode
...& LIBNBD_CMD_FLAG_FAST_ZERO) != 0 &&
+ nbd_unlocked_can_fast_zero (h) != 1) {
+ set_error (EINVAL, "server does not support the fast zero flag");
+ return -1;
+ }
}
if (count == 0) { /* NBD protocol forbids this. */
@@ -471,21 +485,23 @@ nbd_unlocked_aio_block_status (struct nbd_handle *h,
struct command_cb cb = { .fn.extent = extent,
.completion = completion };
- if (!h->structured_replies) {
- set_error (ENOTSUP, "server does not support structured replies");
- return -1;
- }
+ if (h->strict & LIBNB...