From 33d1cfc63c8fd0bbfd85a7b90e8b1fc7b557bc9f Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 31 Mar 2005 19:07:15 +0000 Subject: [PATCH] fix --- ChangeLog | 2 ++ kernel/dev.c | 11 +++++++++-- kernel/fuse_i.h | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 489cbf8..e164366 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ * kernel: fix warnings on 64bit archs + * kernel: in case of API version mismatch, return ECONNREFUSED + 2005-03-24 Miklos Szeredi * kernel: trivial cleanups diff --git a/kernel/dev.c b/kernel/dev.c index 0c80aa0..29a9b63 100644 --- a/kernel/dev.c +++ b/kernel/dev.c @@ -221,6 +221,10 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) 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 @@ -367,8 +371,11 @@ static void request_send_wait(struct fuse_conn *fc, struct fuse_req *req, { 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 --git a/kernel/fuse_i.h b/kernel/fuse_i.h index d877071..759278d 100644 --- a/kernel/fuse_i.h +++ b/kernel/fuse_i.h @@ -325,6 +325,9 @@ struct fuse_conn { /** Is removexattr not implemented by fs? */ unsigned no_removexattr : 1; + /** Connection failed (version mismatch) */ + unsigned conn_error : 1; + #ifdef KERNEL_2_6 /** Backing dev info */ struct backing_dev_info bdi; -- 2.30.2