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

[Nbd] [PATCH] Fix flags processing to avoid bogus read-only export



As described here:
  https://www.mail-archive.com/nbd-general@lists.sourceforge.net/msg03878.html

NBD clients prior to 3.10 incorrectly attempt to merge the server flags
with the transmission flags. This means that any such client cannot connect
to a server (e.g. NBD server post 3.10, gonbdserver) which supports
NBD_FLAG_NO_ZEROES without making the export read-only.

This one line fix avoids the issue by simply passing the kernel the
transmission flags without an attempt to merge them. This is the
behaviour nbd-client (post 3.10) does, and also qemu's current behaviour.

Signed-off-by: Alex Bligh <alex@...872...>
---
 nbd-client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nbd-client.c b/nbd-client.c
index cc9a06e..ddc849c 100644
--- a/nbd-client.c
+++ b/nbd-client.c
@@ -318,7 +318,7 @@ void negotiate(int sock, u64 *rsize64, u32 *flags, char* name, uint32_t needed_f
 	} else {
 		if(read(sock, &tmp, sizeof(tmp)) < 0)
 			err("Failed/4: %m\n");
-		*flags |= (uint32_t)ntohs(tmp);
+		*flags = (uint32_t)ntohs(tmp);
 	}
 
 	if (read(sock, &buf, 124) < 0)
-- 
1.9.1




Reply to: