fix
authorMiklos Szeredi <miklos@szeredi.hu>
Mon, 16 Aug 2004 13:41:19 +0000 (13:41 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Mon, 16 Aug 2004 13:41:19 +0000 (13:41 +0000)
ChangeLog
kernel/dev.c
kernel/dir.c
kernel/file.c
kernel/fuse_i.h

index 34694d6e7be5fb3d2416cf73204bc89e2343fcef..7637b9bd8c6dfe1a97e5ccbd91ec84c5323e79a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-08-16  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Change release method to be non-interruptible.  Fixes bug
+       causing missing release() call when program which has opened files
+       is killed (reported by Franco Broi and David Shaw)
 2004-07-26  Miklos Szeredi <miklos@szeredi.hu>
 
        * Check permissions in setattr if 'default_permissions' flag is
index 2f778fc57440ff376e791aa479d4f81c70b2073f..7f6900b60e29e3f786d1e8d1295c87e4ff84cb1a 100644 (file)
@@ -62,12 +62,17 @@ static int request_restartable(enum fuse_opcode opcode)
 }
 
 /* Called with fuse_lock held.  Releases, and then reaquires it. */
-static void request_wait_answer(struct fuse_req *req)
+static void request_wait_answer(struct fuse_req *req, int interruptible)
 {
        int intr;
        
        spin_unlock(&fuse_lock);
-       intr = wait_event_interruptible(req->waitq, req->finished);
+       if (interruptible)
+               intr = wait_event_interruptible(req->waitq, req->finished);
+       else {
+               wait_event(req->waitq, req->finished);
+               intr = 0;
+       }
        spin_lock(&fuse_lock);
        if(!intr)
                return;
@@ -112,14 +117,17 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
        }
 }
 
-void request_send(struct fuse_conn *fc, struct fuse_in *in,
-                 struct fuse_out *out)
+void __request_send(struct fuse_conn *fc, struct fuse_in *in,
+                   struct fuse_out *out, int interruptible)
 {
        struct fuse_req *req;
 
-       out->h.error = -ERESTARTSYS;
-       if(down_interruptible(&fc->outstanding))
-               return;
+       if (interruptible) {
+               out->h.error = -ERESTARTSYS;
+               if(down_interruptible(&fc->outstanding))
+                       return;
+       } else
+               down(&fc->outstanding);
 
        out->h.error = -ENOMEM;
        req = request_new();
@@ -135,7 +143,7 @@ void request_send(struct fuse_conn *fc, struct fuse_in *in,
                        in->h.unique = get_unique(fc);          
                        list_add_tail(&req->list, &fc->pending);
                        wake_up(&fc->waitq);
-                       request_wait_answer(req);
+                       request_wait_answer(req, interruptible);
                        list_del(&req->list);
                }
                spin_unlock(&fuse_lock);
@@ -145,6 +153,17 @@ void request_send(struct fuse_conn *fc, struct fuse_in *in,
        up(&fc->outstanding);
 }
 
+void request_send(struct fuse_conn *fc, struct fuse_in *in,
+                 struct fuse_out *out)
+{
+       __request_send(fc, in, out, 1);
+}
+
+void request_send_nonint(struct fuse_conn *fc, struct fuse_in *in,
+                        struct fuse_out *out)
+{
+       __request_send(fc, in, out, 0);
+}
 
 static inline void destroy_request(struct fuse_req *req)
 {
index 1de005815c426049db9d62d24bc33db6efb0d665..4a140a5808cfd464b62de72b2216827b033d9124 100644 (file)
@@ -635,7 +635,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
        struct fuse_setattr_out outarg;
 
        if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
-               err = inode_change_ok(inode, attr);
+               int err = inode_change_ok(inode, attr);
                if (err)
                        return err;
        }
index fdd4d0bd5b6fef59cd65bb6c541020e44aeb6e14..2ba3163571b8f4fcf877241de51205efc1c8300b 100644 (file)
@@ -118,7 +118,7 @@ static int fuse_release(struct inode *inode, struct file *file)
        in.numargs = 1;
        in.args[0].size = sizeof(inarg);
        in.args[0].value = &inarg;
-       request_send(fc, &in, &out);
+       request_send_nonint(fc, &in, &out);
        if (out.h.error == -ENOSYS) {
                fc->oldrelease = 1;
                return fuse_release_old(inode, file);
index 7c67e49c04904791efe11c9ee6093449ca688633..c81c41ac059d318fab7a1b7c89f9e5087c979657 100644 (file)
@@ -220,6 +220,13 @@ void fuse_fs_cleanup(void);
 void request_send(struct fuse_conn *fc, struct fuse_in *in,
                  struct fuse_out *out);
 
+/**
+ * Send a non-interruptible request
+ *
+ */
+void request_send_nonint(struct fuse_conn *fc, struct fuse_in *in,
+                        struct fuse_out *out);
+
 /**
  * Send a request for which a reply is not expected
  */