[Nbd] [PATCH] Fix handling of oversize writes
- To: nbd-general@lists.sourceforge.net
- Subject: [Nbd] [PATCH] Fix handling of oversize writes
- From: Alex Bligh <alex@...872...>
- Date: Sat, 28 May 2011 19:31:14 +0100
- Message-id: <1306607474-8958-1-git-send-email-alex@...872...>
Oversize writes were attempting to write the whole length of the
write each time, rather than BUFSIZ chunks. This could cause
disk corruption.
Available from git.alex.org.uk as usual.
--
Alex Bligh
Signed-off-by: Alex Bligh <alex@...872...>
---
nbd-server.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/nbd-server.c b/nbd-server.c
index 695deef..d57120b 100644
--- a/nbd-server.c
+++ b/nbd-server.c
@@ -1568,7 +1568,7 @@ int mainloop(CLIENT *client) {
consume(client->net, buf, len-currlen, BUFSIZE);
continue;
}
- if (expwrite(request.from, buf, len, client,
+ if (expwrite(request.from, buf, currlen, client,
request.type & NBD_CMD_FLAG_FUA)) {
DEBUG("Write failed: %m" );
ERROR(client, reply, errno);
--
1.7.4.1
Reply to: