2 Commits

Author SHA1 Message Date
James Carter
b18c46606f Merge branch 'release-to-master' into 'develop'
Updated changelog for release 0.3.0

See merge request open-source/flexnbd-c!52
2018-04-24 12:12:06 +01:00
Patrick J Cherry
b3cea813e4 Updated changelog for release 2018-04-24 12:06:06 +01:00
4 changed files with 33 additions and 33 deletions

6
debian/changelog vendored
View File

@@ -1,8 +1,8 @@
flexnbd (0.2.1) UNRELEASED; urgency=medium flexnbd (0.3.0) stable; urgency=medium
* Force a msync after every write, ignoring FUA flag, or lack thereof. * Force a msync after every write, ignoring FUA flag, or lack thereof (!51).
-- Patrick J Cherry <patrick@bytemark.co.uk> Tue, 24 Apr 2018 10:27:12 +0100 -- Patrick J Cherry <patrick@bytemark.co.uk> Tue, 24 Apr 2018 12:05:43 +0100
flexnbd (0.2.0) stable; urgency=medium flexnbd (0.2.0) stable; urgency=medium

View File

@@ -148,6 +148,8 @@ int readloop(int filedes, void *buffer, size_t size)
ssize_t result = read(filedes, buffer + readden, size - readden); ssize_t result = read(filedes, buffer + readden, size - readden);
if (result == 0 /* EOF */ ) { if (result == 0 /* EOF */ ) {
warn("end-of-file detected while reading after %i bytes",
readden);
return -1; return -1;
} }
@@ -222,8 +224,9 @@ int splice_via_pipe_loop(int fd_in, int fd_out, size_t len)
while (spliced < len) { while (spliced < len) {
ssize_t run = len - spliced; ssize_t run = len - spliced;
ssize_t s2, s1 = spliceloop(fd_in, NULL, pipefd[1], NULL, run, ssize_t s2, s1 =
SPLICE_F_NONBLOCK); spliceloop(fd_in, NULL, pipefd[1], NULL, run,
SPLICE_F_NONBLOCK);
/*if (run > 65535) /*if (run > 65535)
run = 65535; */ run = 65535; */
if (s1 < 0) { if (s1 < 0) {

View File

@@ -76,7 +76,7 @@ int socket_nbd_read_hello(int fd, uint64_t * out_size,
if (0 > readloop(fd, &init_raw, sizeof(init_raw))) { if (0 > readloop(fd, &init_raw, sizeof(init_raw))) {
warn(SHOW_ERRNO("Couldn't read init")); warn("Couldn't read init");
return 0; return 0;
} }
@@ -130,7 +130,7 @@ void read_reply(int fd, uint64_t request_raw_handle,
ERROR_IF_NEGATIVE(readloop ERROR_IF_NEGATIVE(readloop
(fd, &reply_raw, sizeof(struct nbd_reply_raw)), (fd, &reply_raw, sizeof(struct nbd_reply_raw)),
SHOW_ERRNO("Couldn't read reply")); "Couldn't read reply");
nbd_r2h_reply(&reply_raw, reply); nbd_r2h_reply(&reply_raw, reply);
@@ -171,15 +171,14 @@ void socket_nbd_read(int fd, uint64_t from, uint32_t len, int out_fd,
fill_request(&request_raw, REQUEST_READ, 0, from, len); fill_request(&request_raw, REQUEST_READ, 0, from, len);
FATAL_IF_NEGATIVE(writeloop(fd, &request_raw, sizeof(request_raw)), FATAL_IF_NEGATIVE(writeloop(fd, &request_raw, sizeof(request_raw)),
SHOW_ERRNO("Couldn't write request")); "Couldn't write request");
wait_for_data(fd, timeout_secs); wait_for_data(fd, timeout_secs);
read_reply(fd, request_raw.handle.w, &reply); read_reply(fd, request_raw.handle.w, &reply);
if (out_buf) { if (out_buf) {
FATAL_IF_NEGATIVE(readloop(fd, out_buf, len), FATAL_IF_NEGATIVE(readloop(fd, out_buf, len), "Read failed");
SHOW_ERRNO("Read failed"));
} else { } else {
FATAL_IF_NEGATIVE(splice_via_pipe_loop(fd, out_fd, len), FATAL_IF_NEGATIVE(splice_via_pipe_loop(fd, out_fd, len),
"Splice failed"); "Splice failed");
@@ -194,11 +193,10 @@ void socket_nbd_write(int fd, uint64_t from, uint32_t len, int in_fd,
fill_request(&request_raw, REQUEST_WRITE, 0, from, len); fill_request(&request_raw, REQUEST_WRITE, 0, from, len);
ERROR_IF_NEGATIVE(writeloop(fd, &request_raw, sizeof(request_raw)), ERROR_IF_NEGATIVE(writeloop(fd, &request_raw, sizeof(request_raw)),
SHOW_ERRNO("Couldn't write request")); "Couldn't write request");
if (in_buf) { if (in_buf) {
ERROR_IF_NEGATIVE(writeloop(fd, in_buf, len), ERROR_IF_NEGATIVE(writeloop(fd, in_buf, len), "Write failed");
SHOW_ERRNO("Write failed"));
} else { } else {
ERROR_IF_NEGATIVE(splice_via_pipe_loop(in_fd, fd, len), ERROR_IF_NEGATIVE(splice_via_pipe_loop(in_fd, fd, len),
"Splice failed"); "Splice failed");
@@ -219,8 +217,7 @@ int socket_nbd_disconnect(int fd)
* the mirror without affecting the main server. * the mirror without affecting the main server.
*/ */
FATAL_IF_NEGATIVE(writeloop(fd, &request_raw, sizeof(request_raw)), FATAL_IF_NEGATIVE(writeloop(fd, &request_raw, sizeof(request_raw)),
SHOW_ERRNO "Failed to write the disconnect request.");
("Failed to write the disconnect request."));
return success; return success;
} }

View File

@@ -152,7 +152,7 @@ void write_not_zeroes(struct client *client, uint64_t from, uint64_t len)
(dst), \ (dst), \
(len) \ (len) \
), \ ), \
SHOW_ERRNO("read failed %ld+%d", from, (len)) \ "read failed %ld+%d", from, (len) \
) )
if (bitset_is_set_at(map, from)) { if (bitset_is_set_at(map, from)) {
@@ -232,13 +232,13 @@ int client_read_request(struct client *client,
*disconnected = 1; *disconnected = 1;
switch (errno) { switch (errno) {
case 0: case 0:
warn(SHOW_ERRNO("EOF while reading request")); warn("EOF while reading request");
return 0; return 0;
case ECONNRESET: case ECONNRESET:
warn(SHOW_ERRNO("Connection reset while reading request")); warn("Connection reset while" " reading request");
return 0; return 0;
case ETIMEDOUT: case ETIMEDOUT:
warn(SHOW_ERRNO("Connection timed out while reading request")); warn("Connection timed out while" " reading request");
return 0; return 0;
default: default:
/* FIXME: I've seen this happen, but I /* FIXME: I've seen this happen, but I
@@ -248,7 +248,7 @@ int client_read_request(struct client *client,
* again. It should *probably* be an * again. It should *probably* be an
* error() call, but I want to be sure. * error() call, but I want to be sure.
* */ * */
fatal(SHOW_ERRNO("Error reading request")); fatal("Error reading request: %d, %s", errno, strerror(errno));
} }
} }
@@ -271,17 +271,16 @@ int fd_write_reply(int fd, uint64_t handle, int error)
if (-1 == writeloop(fd, &reply_raw, sizeof(reply_raw))) { if (-1 == writeloop(fd, &reply_raw, sizeof(reply_raw))) {
switch (errno) { switch (errno) {
case ECONNRESET: case ECONNRESET:
error(SHOW_ERRNO("Connection reset while writing reply")); error("Connection reset while writing reply");
break; break;
case EBADF: case EBADF:
fatal(SHOW_ERRNO fatal("Tried to write to an invalid file descriptor");
("Tried to write to an invalid file descriptor"));
break; break;
case EPIPE: case EPIPE:
error(SHOW_ERRNO("Remote end closed")); error("Remote end closed");
break; break;
default: default:
fatal(SHOW_ERRNO("Unhandled error while writing")); fatal("Unhandled error while writing: %d", errno);
} }
} }
@@ -319,7 +318,7 @@ void client_write_init(struct client *client, uint64_t size)
ERROR_IF_NEGATIVE(writeloop ERROR_IF_NEGATIVE(writeloop
(client->socket, &init_raw, sizeof(init_raw)), (client->socket, &init_raw, sizeof(init_raw)),
SHOW_ERRNO("Couldn't send hello")); "Couldn't send hello");
} }
@@ -330,7 +329,8 @@ void client_write_init(struct client *client, uint64_t size)
void client_flush(struct client *client, size_t len) void client_flush(struct client *client, size_t len)
{ {
int devnull = open("/dev/null", O_WRONLY); int devnull = open("/dev/null", O_WRONLY);
FATAL_IF_NEGATIVE(devnull, SHOW_ERRNO("Couldn't open /dev/null")); FATAL_IF_NEGATIVE(devnull,
"Couldn't open /dev/null: %s", strerror(errno));
int pipes[2]; int pipes[2];
pipe(pipes); pipe(pipes);
@@ -341,12 +341,12 @@ void client_flush(struct client *client, size_t len)
ssize_t received = splice(client->socket, NULL, ssize_t received = splice(client->socket, NULL,
pipes[1], NULL, pipes[1], NULL,
len - spliced, flags); len - spliced, flags);
FATAL_IF_NEGATIVE(received, SHOW_ERRNO("splice error")); FATAL_IF_NEGATIVE(received, "splice error: %s", strerror(errno));
ssize_t junked = 0; ssize_t junked = 0;
while (junked < received) { while (junked < received) {
ssize_t junk; ssize_t junk;
junk = splice(pipes[0], NULL, devnull, NULL, received, flags); junk = splice(pipes[0], NULL, devnull, NULL, received, flags);
FATAL_IF_NEGATIVE(junk, SHOW_ERRNO("splice error")); FATAL_IF_NEGATIVE(junk, "splice error: %s", strerror(errno));
junked += junk; junked += junk;
} }
spliced += received; spliced += received;
@@ -459,8 +459,8 @@ void client_reply_to_write(struct client *client,
ERROR_IF_NEGATIVE(readloop(client->socket, ERROR_IF_NEGATIVE(readloop(client->socket,
client->mapped + request.from, client->mapped + request.from,
request.len), request.len),
SHOW_ERRNO("reading write data failed from=%ld, len=%d", "reading write data failed from=%ld, len=%d",
request.from, request.len)); request.from, request.len);
/* the allocation_map is shared between client threads, and may be /* the allocation_map is shared between client threads, and may be
* being built. We need to reflect the write in it, as it may be in * being built. We need to reflect the write in it, as it may be in
@@ -693,8 +693,8 @@ void *client_serve(void *client_uncast)
&client->fileno, &client->fileno,
&client->mapped_size, &client->mapped_size,
(void **) &client->mapped), (void **) &client->mapped),
SHOW_ERRNO("Couldn't open/mmap file %s", "Couldn't open/mmap file %s: %s",
client->serve->filename) client->serve->filename, strerror(errno)
); );
FATAL_IF_NEGATIVE(madvise FATAL_IF_NEGATIVE(madvise