From: Miklos Szeredi <miklos@szeredi.hu>

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 <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/fuse/dev.c        |   11 +++++++++--
 25-akpm/fs/fuse/fuse_i.h     |    3 +++
 25-akpm/include/linux/fuse.h |    2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff -puN fs/fuse/dev.c~fuse-device-functions-abi-version-change fs/fuse/dev.c
--- 25/fs/fuse/dev.c~fuse-device-functions-abi-version-change	Thu Mar 31 15:05:53 2005
+++ 25-akpm/fs/fuse/dev.c	Thu Mar 31 15:05:53 2005
@@ -158,6 +158,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
@@ -270,8 +274,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 -puN fs/fuse/fuse_i.h~fuse-device-functions-abi-version-change fs/fuse/fuse_i.h
--- 25/fs/fuse/fuse_i.h~fuse-device-functions-abi-version-change	Thu Mar 31 15:05:53 2005
+++ 25-akpm/fs/fuse/fuse_i.h	Thu Mar 31 15:05:53 2005
@@ -190,6 +190,9 @@ struct fuse_conn {
 	/** The next unique request id */
 	int reqctr;
 
+	/** Connection failed (version mismatch) */
+	unsigned conn_error : 1;
+
 	/** Backing dev info */
 	struct backing_dev_info bdi;
 };
diff -puN include/linux/fuse.h~fuse-device-functions-abi-version-change include/linux/fuse.h
--- 25/include/linux/fuse.h~fuse-device-functions-abi-version-change	Thu Mar 31 15:05:53 2005
+++ 25-akpm/include/linux/fuse.h	Thu Mar 31 15:05:53 2005
@@ -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
_