release() changes
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 10 Dec 2002 14:54:57 +0000 (14:54 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Tue, 10 Dec 2002 14:54:57 +0000 (14:54 +0000)
kernel/dev.c
kernel/file.c
kernel/fuse_i.h
lib/fuse.c

index 002e23b17606330422e021116d58bb7dad1dbe1a..e703b11ebf11dcaa0e1991fc66a028dd48cfb325 100644 (file)
@@ -142,8 +142,9 @@ static inline void destroy_request(struct fuse_conn *fc, struct fuse_req *req)
        }
 }
 
-/* This one is currently only used for sending the FORGET request, which is
-   a kernel initiated request.  So the outstanding semaphore is not used.  */
+/* This one is currently only used for sending FORGET and RELEASE,
+   which are kernel initiated request.  So the outstanding semaphore
+   is not used.  */
 int request_send_noreply(struct fuse_conn *fc, struct fuse_in *in)
 {
        struct fuse_req *req;
@@ -447,7 +448,6 @@ static struct fuse_conn *new_conn(void)
                INIT_LIST_HEAD(&fc->processing);
                sema_init(&fc->outstanding, MAX_OUTSTANDING);
                fc->reqctr = 1;
-               fc->has_release = 1;
        }
        return fc;
 }
index 49401176c522d65a43abe1fdf34923a306bf5152..0ba489244d940372de5ef8c1024e3fe6dd404b53 100644 (file)
@@ -43,22 +43,21 @@ static int fuse_open(struct inode *inode, struct file *file)
 static int fuse_release(struct inode *inode, struct file *file)
 {
        struct fuse_conn *fc = INO_FC(inode);
-       struct fuse_in in = FUSE_IN_INIT;
-       struct fuse_out out = FUSE_OUT_INIT;
+       struct fuse_in *in = NULL;
 
-       if(!fc->has_release)
-               return 0;
+       in = kmalloc(sizeof(struct fuse_in), GFP_NOFS);
+       if(!in)
+               return -ENOMEM;
 
-       in.h.opcode = FUSE_RELEASE;
-       in.h.ino = inode->i_ino;
-       request_send(fc, &in, &out);
+       memset(in, 0, sizeof(struct fuse_in));
 
-       if(out.h.error == -ENOSYS) {
-               fc->has_release = 0;
+       in->h.opcode = FUSE_RELEASE;
+       in->h.ino = inode->i_ino;
+       if(!request_send_noreply(fc, in))
                return 0;
-       }
 
-       return out.h.error;
+       kfree(in);
+       return 0;
 }
 
 
index e4730e65dcce7a5242e9992e2b6f14a2ffcd2336..23cc914fa36d39e47fffef691296606bd5c17d85 100644 (file)
@@ -56,9 +56,6 @@ struct fuse_conn {
        
        /** The next unique request id */
        int reqctr;
-
-       /* Flag indicating whether the release call is supported */
-       int has_release;
 };
 
 /** One input argument of a request */
index 71959c4b7c16037eb1e597462f2b4eb15bd4e016..fe670d8648d01a121224abc0a6e50841b09cf4f3 100644 (file)
@@ -755,18 +755,14 @@ static void do_open(struct fuse *f, struct fuse_in_header *in,
 
 static void do_release(struct fuse *f, struct fuse_in_header *in)
 {
-    int res;
     char *path;
 
-    res = -ENOENT;
     path = get_path(f, in->ino);
     if(path != NULL) {
-        res = -ENOSYS;
         if(f->op.release)
-            res = f->op.release(path);
+            f->op.release(path);
         free(path);
     }
-    send_reply(f, in, res, NULL, 0);
 }
 
 static void do_read(struct fuse *f, struct fuse_in_header *in,