[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] Read-only handling bug in server



I hunted down a bug in the server dealing with read-only support.  If
the server is set to read-only and a write request comes in, it does not
read the rest of the write buffer and gets out of sync with the data
stream.  I've attached a simple patch to fix the problem.

-Corey
--- nbd-2.8.0.old/nbd-server.c	2006-04-17 10:36:19.651263568 -0500
+++ nbd-2.8.0/nbd-server.c	2006-04-17 12:56:56.886332550 -0500
@@ -692,6 +692,9 @@
 		if (((ssize_t)((off_t)request.from + len) > client->exportsize) ||
 		    ((client->server->flags & F_READONLY) && request.type)) {
 			DEBUG("[RANGE!]");
+			/* Make sure we read the data, so we don't get out
+			   of sync. */
+			readit(client->net, buf, len);
 			ERROR(client, reply);
 			continue;
 		}

Reply to: