[PATCH] FUSE: 3/3 ABI version change

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

 



Change ABI major version from 5 to 6, and check if userspace supports
the new interface.  If the version in INIT reply doesn't match the
current one, return ECONNREFUSED error on all operations.

Signed-off-by: Miklos Szeredi <[email protected]>

diff -rup linux-2.6.12-rc1-mm4/fs/fuse/dev.c linux-fuse/fs/fuse/dev.c
--- linux-2.6.12-rc1-mm4/fs/fuse/dev.c	2005-03-31 21:43:42.000000000 +0200
+++ linux-fuse/fs/fuse/dev.c	2005-03-31 21:50:31.000000000 +0200
@@ -183,6 +183,10 @@ static void request_end(struct fuse_conn
 	wake_up(&req->waitq);
 	if (req->in.h.opcode == FUSE_INIT) {
 		int i;
+
+		if (req->misc.init_in_out.major != FUSE_KERNEL_VERSION)
+			fc->conn_error = 1;
+
 		/* After INIT reply is received other requests can go
 		   out.  So do (FUSE_MAX_OUTSTANDING - 1) number of
 		   up()s on outstanding_sem.  The last up() is done in
@@ -329,8 +333,11 @@ static void request_send_wait(struct fus
 {
 	req->isreply = 1;
 	spin_lock(&fuse_lock);
-	req->out.h.error = -ENOTCONN;
-	if (fc->file) {
+	if (!fc->file)
+		req->out.h.error = -ENOTCONN;
+	else if (fc->conn_error)
+		req->out.h.error = -ECONNREFUSED;
+	else {
 		queue_request(fc, req);
 		/* acquire extra reference, since request is still needed
 		   after request_end() */
diff -rup linux-2.6.12-rc1-mm4/fs/fuse/fuse_i.h linux-fuse/fs/fuse/fuse_i.h
--- linux-2.6.12-rc1-mm4/fs/fuse/fuse_i.h	2005-03-31 21:43:42.000000000 +0200
+++ linux-fuse/fs/fuse/fuse_i.h	2005-03-31 21:50:31.000000000 +0200
@@ -261,6 +261,9 @@ struct fuse_conn {
 	/** Is removexattr not implemented by fs? */
 	unsigned no_removexattr : 1;
 
+	/** Connection failed (version mismatch) */
+	unsigned conn_error : 1;
+
 	/** Backing dev info */
 	struct backing_dev_info bdi;
 };
diff -rup linux-2.6.12-rc1-mm4/include/linux/fuse.h linux-fuse/include/linux/fuse.h
--- linux-2.6.12-rc1-mm4/include/linux/fuse.h	2005-03-31 21:50:44.000000000 +0200
+++ linux-fuse/include/linux/fuse.h	2005-03-31 21:50:31.000000000 +0200
@@ -11,7 +11,7 @@
 #include <asm/types.h>
 
 /** Version number of this interface */
-#define FUSE_KERNEL_VERSION 5
+#define FUSE_KERNEL_VERSION 6
 
 /** Minor version number of this interface */
 #define FUSE_KERNEL_MINOR_VERSION 1

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux