Displaying 20 results from an estimated 27 matches for "nbd_eperm".
2017 Dec 02
1
[nbdkit PATCH v2] nbd: Fix memory leak
...->count;
+ free (trans);
switch (be32toh (rep.error)) {
case NBD_SUCCESS:
- if (trans->buf && read_full (h->fd, trans->buf, trans->count) < 0)
+ if (buf && read_full (h->fd, buf, count) < 0)
return nbd_mark_dead (h);
return 0;
case NBD_EPERM:
@@ -399,6 +404,7 @@ nbd_reader (void *handle)
abort ();
}
close (trans->u.fds[1]);
+ free (trans);
}
return NULL;
}
--
2.14.3
2018 Dec 06
0
[PATCH nbdkit 3/5] protocol: Generate map functions from NBD protocol flags to printable strings.
...NBD_CMD_FLAG_FUA (1<<0)
#define NBD_CMD_FLAG_NO_HOLE (1<<1)
/* Error codes (previously errno).
* See http://git.qemu.org/?p=qemu.git;a=commitdiff;h=ca4414804114fd0095b317785bc0b51862e62ebb
*/
+extern const char *name_of_nbd_error (int);
#define NBD_SUCCESS 0
#define NBD_EPERM 1
#define NBD_EIO 5
diff --git a/.gitignore b/.gitignore
index 86ef6cb..8cfe734 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,6 +47,7 @@ Makefile.in
/podwrapper.pl
/src/nbdkit
/src/nbdkit.pc
+/src/protostrings.c
/src/synopsis.c
/src/test-utils
/stamp-h1
diff --git a/src/Makef...
2019 Jun 21
0
[libnbd PATCH v2 3/5] states: Add nbd_pread_structured API
...set_be_chunk(&chunk.h, final ? NBD_REPLY_FLAG_DONE : 0,
| + NBD_REPLY_TYPE_ERROR_OFFSET,
| + handle, sizeof(chunk) - sizeof(chunk.h) +
| + 3 + sizeof(off));
| + stl_be_p(&chunk.error, NBD_EPERM);
| + stw_be_p(&chunk.message_length, 3);
| + stq_be_p(&off, offset + progress);
| + ret = nbd_co_send_iov(client, iov, 3, errp);
| + }
| } else {
| ret = blk_pread(exp->blk, offset + progress + exp->dev_off...
2017 Nov 21
6
[nbdkit PATCH v2 0/4] enable parallel nbd forwarding
With this, I am finally able to get the nbd plugin to do out-of-order
responses to the client. Once this series goes in, we should be
ready for Rich to cut a release.
Eric Blake (4):
nbd: Split reading into separate thread
nbd: Protect writes with mutex
nbd: Enable parallel handling
tests: Test parallel nbd behavior
plugins/nbd/nbd.c | 217
2019 Sep 24
0
[PATCH nbdkit 2/4] common/protocol: Remove protostrings.sed, use bash+sed instead.
...(1<<2)
@@ -233,7 +224,6 @@ extern const char *name_of_nbd_cmd_flag (int);
/* Error codes (previously errno).
* See http://git.qemu.org/?p=qemu.git;a=commitdiff;h=ca4414804114fd0095b317785bc0b51862e62ebb
*/
-extern const char *name_of_nbd_error (int);
#define NBD_SUCCESS 0
#define NBD_EPERM 1
#define NBD_EIO 5
diff --git a/common/protocol/protostrings.h b/common/protocol/protostrings.h
new file mode 100644
index 0000000..8029652
--- /dev/null
+++ b/common/protocol/protostrings.h
@@ -0,0 +1,51 @@
+/* nbdkit
+ * Copyright (C) 2018-2019 Red Hat Inc.
+ *
+ * Redistribution...
2019 Apr 23
0
[nbdkit PATCH 7/7] nbd: Implement structured replies
...lse
+ count = len;
+ }
free (trans);
- switch (be32toh (rep.error)) {
+ switch (error) {
case NBD_SUCCESS:
- if (buf && read_full (h->fd, buf, count) < 0)
+ if (buf && read_full (h->fd, buf, count))
return nbd_mark_dead (h);
return 0;
case NBD_EPERM:
@@ -378,8 +544,7 @@ nbd_reply_raw (struct handle *h, int *fd)
case NBD_ENOMEM:
return ENOMEM;
default:
- nbdkit_debug ("unexpected error %d, squashing to EINVAL",
- be32toh (rep.error));
+ nbdkit_debug ("unexpected error %d, squashing to EINVAL"...
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...set_be_chunk(&chunk.h, final ? NBD_REPLY_FLAG_DONE : 0,
| + NBD_REPLY_TYPE_ERROR_OFFSET,
| + handle, sizeof(chunk) - sizeof(chunk.h) +
| + 3 + sizeof(off));
| + stl_be_p(&chunk.error, NBD_EPERM);
| + stw_be_p(&chunk.message_length, 3);
| + stq_be_p(&off, offset + progress);
| + ret = nbd_co_send_iov(client, iov, 3, errp);
| + }
| } else {
| ret = blk_pread(exp->blk, offset + progress + exp->dev_off...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...ly_error {
#define NBD_CMD_FLAG_REQ_ONE (1<<3)
#define NBD_CMD_FLAG_FAST_ZERO (1<<4)
-/* Error codes (previously errno).
- * See http://git.qemu.org/?p=qemu.git;a=commitdiff;h=ca4414804114fd0095b317785bc0b51862e62ebb
- */
+/* NBD error codes. */
#define NBD_SUCCESS 0
#define NBD_EPERM 1
#define NBD_EIO 5
diff --git a/server/protocol-handshake-newstyle.c b/server/protocol-handshake-newstyle.c
index 104796a..413dcf0 100644
--- a/server/protocol-handshake-newstyle.c
+++ b/server/protocol-handshake-newstyle.c
@@ -55,7 +55,7 @@ static int
send_newstyle_option_reply (s...
2019 Sep 24
11
[PATCH nbdkit 0/4] common/protocol: Unify public <nbd-protocol.h>
We should have only one NBD protocol file. Let's make nbdkit's
version the canonical one, and use it in libnbd.
Rich.
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.
2017 Nov 14
0
[nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
...p.magic) != NBD_REPLY_MAGIC || rep.handle != trans->cookie)
+ return nbd_mark_dead (h);
+ switch (be32toh (rep.error)) {
+ case NBD_SUCCESS:
+ if (trans->buf && read_full (h->fd, trans->buf, trans->count) < 0)
+ return nbd_mark_dead (h);
+ return 0;
+ case NBD_EPERM:
+ return EPERM;
+ case NBD_EIO:
+ return EIO;
+ case NBD_ENOMEM:
+ return ENOMEM;
+ default:
+ nbdkit_debug ("unexpected error %d, squashing to EINVAL",
+ be32toh (rep.error));
+ /* fallthrough */
+ case NBD_EINVAL:
+ return EINVAL;
+ case NBD_ENOS...
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...d early EOF");
- errno = EBADMSG;
- return -1;
- }
- count -= r;
- }
- return 0;
-}
-
-/* Convert a system errno to an NBD_E* error code. */
-static int
-nbd_errno (int error)
-{
- switch (error) {
- case 0:
- return NBD_SUCCESS;
- case EROFS:
- case EPERM:
- return NBD_EPERM;
- case EIO:
- return NBD_EIO;
- case ENOMEM:
- return NBD_ENOMEM;
-#ifdef EDQUOT
- case EDQUOT:
-#endif
- case EFBIG:
- case ENOSPC:
- return NBD_ENOSPC;
-#ifdef ESHUTDOWN
- case ESHUTDOWN:
- return NBD_ESHUTDOWN;
-#endif
- case EINVAL:
- default:
- return NBD_EINVAL;
- }
-...
2017 Nov 12
6
[nbdkit PATCH] nbd: Add new nbd forwarding plugin
...("received reply for cookie %" PRIu64, cookie);
+ if (be32toh (rep.magic) != NBD_REPLY_MAGIC ||
+ be64toh (rep.handle) != cookie) {
+ nbdkit_set_error (EIO);
+ h->dead = true;
+ return -1;
+ }
+ switch (be32toh (rep.error)) {
+ case NBD_SUCCESS:
+ return 0;
+ case NBD_EPERM:
+ nbdkit_set_error (EPERM);
+ return -1;
+ case NBD_EIO:
+ nbdkit_set_error (EIO);
+ return -1;
+ case NBD_ENOMEM:
+ nbdkit_set_error (ENOMEM);
+ return -1;
+ default:
+ nbdkit_debug ("unexpected error %d, squashing to EINVAL",
+ be32toh (rep.error));
+ /* f...
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.
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.
2017 Jan 26
10
[nbdkit PATCH v2 0/6] bind .zero to Python
Fix some things I noticed while reviewing v1, and follow Rich's
idea to add a new nbdkit_set_error() utility function with a
binding for Python users to request a particular error (rather
than being forced to live with whatever stale value is in errno
after all the intermediate binding glue code).
I could not easily find out how to register a C function callable
from perl bindings, and have
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 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
...(error && !trans->err)
- trans->err = error;
-
- /* Convert from wire value to local errno, and perform any final read */
- switch (error) {
- case NBD_SUCCESS:
- if (buf && read_full (h->fd, buf, count))
- return nbdplug_mark_dead (h);
- return 0;
- case NBD_EPERM:
- return EPERM;
- case NBD_EIO:
- return EIO;
- case NBD_ENOMEM:
- return ENOMEM;
- default:
- nbdkit_debug ("unexpected error %d, squashing to EINVAL", error);
- /* fallthrough */
- case NBD_EINVAL:
- return EINVAL;
- case NBD_ENOSPC:
- return ENOSPC;
- case N...
2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
...(error && !trans->err)
- trans->err = error;
-
- /* Convert from wire value to local errno, and perform any final read */
- switch (error) {
- case NBD_SUCCESS:
- if (buf && read_full (h->fd, buf, count))
- return nbdplug_mark_dead (h);
- return 0;
- case NBD_EPERM:
- return EPERM;
- case NBD_EIO:
- return EIO;
- case NBD_ENOMEM:
- return ENOMEM;
- default:
- nbdkit_debug ("unexpected error %d, squashing to EINVAL", error);
- /* fallthrough */
- case NBD_EINVAL:
- return EINVAL;
- case NBD_ENOSPC:
- return ENOSPC;
- case N...