Linux 2.6.18 vs NBD

Version 2.6.18 of the kernel contained a small(ish) change to <linux/nbd.h>:

--- nbd.h	2006-10-17 19:53:55.000000000 +0200
+++ /usr/include/linux/nbd.h	2006-09-20 05:42:06.000000000 +0200
@@ -37,19 +37,28 @@
 /* userspace doesn't need the nbd_device structure */
 #ifdef __KERNEL__
 
+#include 
+#include 
+
 /* values for flags field */
 #define NBD_READ_ONLY 0x0001
 #define NBD_WRITE_NOCHK 0x0002
 
+struct request;
+
 struct nbd_device {
 	int flags;
 	int harderror;		/* Code of hard error			*/
 	struct socket * sock;
 	struct file * file; 	/* If == NULL, device is not ready, yet	*/
 	int magic;
+
 	spinlock_t queue_lock;
 	struct list_head queue_head;/* Requests are added here...	*/
-	struct semaphore tx_lock;
+	struct request *active_req;
+	wait_queue_head_t active_wq;
+
+	struct mutex tx_lock;
 	struct gendisk *disk;
 	int blksize;
 	u64 bytesize;
@@ -68,11 +77,11 @@
  * server. All data are in network byte order.
  */
 struct nbd_request {
-	u32 magic;
-	u32 type;	/* == READ || == WRITE 	*/
+	__be32 magic;
+	__be32 type;	/* == READ || == WRITE 	*/
 	char handle[8];
-	u64 from;
-	u32 len;
+	__be64 from;
+	__be32 len;
 }
 #ifdef __GNUC__
 	__attribute__ ((packed))
@@ -84,8 +93,8 @@
  * it has completed an I/O request (or an error occurs).
  */
 struct nbd_reply {
-	u32 magic;
-	u32 error;		/* 0 = ok, else error	*/
+	__be32 magic;
+	__be32 error;		/* 0 = ok, else error	*/
 	char handle[8];		/* handle you got from request	*/
 };
 #endif

Which meant that the userland NBD utilities would not build against that anymore. The Debian packages are unaffected (they ship their own nbd.h since they need to build on non-Linux ports, too), but that doesn't mean we can leave it like that.

The first hunk is unimportant, as it's enclosed within an #ifdef __KERNEL__. The others represent an interface change: rather than having u32 and u64, they come with __be32 and __be64. Nothing that can't be fixed with a few #define lines, but still something that had to happen.

So today I released nbd versions 2.7.8 (from the outdated 2.7-branch), 2.8.7 (from the current stable and supported 2.8-branch), and 2.9.0-test3 (from the current development branch) to sourceforge, and released version 1:2.8.7-1 to Debian unstable. I'll probably also release 1:2.9.0-test3-1 to Debian experimental "some time soon", but not just yet.

Apart from the obvious #define lines, the 2.9.0-test3 release also fixes some issues (in contrast to -test2 which was a bit of a crashing horror, -test3 actually works) and has revamped multi-file support. Most of the changes in -test3 (in fact, most likely all of them apart from the #define lines) were done by Phillip Hellewell, whom I owe a beer if I ever see him. Occasionally, the 2.9 line has some extra code and features that aren't available in 2.8, such as configuration file support and the ability to serve multiple block devices from one nbd-server parent process. Check it out if you have a chance and/or are interested.

On top of that, the 1:2.8.7-1 release also contains some fixes in the debconf stuff, that close 3 bugs. Am I cool or what?

Nah.