fix
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 14 Sep 2004 07:13:06 +0000 (07:13 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Tue, 14 Sep 2004 07:13:06 +0000 (07:13 +0000)
ChangeLog
kernel/dev.c
lib/fuse.c

index 29ab0c5b158efb13910f13dfdd56f4e25afa51ed..af9269fb8696a99ddb9b11de28028d3d375c639c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-09-14  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Check temporary file creation failure in do_getdir().  Bug
+       spotted by Terje Oseberg
+       
+2004-09-13  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Make requests non-interruptible so race with FORGET is avoided.
+       This is only a temporary solution
+       
 2004-09-09  Miklos Szeredi <miklos@szeredi.hu>
 
        * Fix bug in case two FORGETs for the same node are executed in
index 7f6900b60e29e3f786d1e8d1295c87e4ff84cb1a..f020f34483779097b046250382d21be16f8c1bd3 100644 (file)
@@ -156,7 +156,9 @@ void __request_send(struct fuse_conn *fc, struct fuse_in *in,
 void request_send(struct fuse_conn *fc, struct fuse_in *in,
                  struct fuse_out *out)
 {
-       __request_send(fc, in, out, 1);
+       /* There are problems with interrupted requests so it's
+          disabled for now */
+       __request_send(fc, in, out, 0);
 }
 
 void request_send_nonint(struct fuse_conn *fc, struct fuse_in *in,
index e954519d510eab105817717a807b155387e1de21..dc56b21ab0e7750d22b0aaf6839484380457facc 100644 (file)
@@ -589,20 +589,27 @@ static void do_getdir(struct fuse *f, struct fuse_in_header *in)
     dh.fuse = f;
     dh.fp = tmpfile();
     dh.dir = in->ino;
-    res = -ENOENT;
-    path = get_path(f, in->ino);
-    if(path != NULL) {
-        res = -ENOSYS;
-        if(f->op.getdir)
-            res = f->op.getdir(path, &dh, (fuse_dirfil_t) fill_dir);
-        free(path);
+    res = -EIO;
+    
+    if (dh.fp == NULL)
+        perror("fuse: failed to create temporary file");
+    else {
+        res = -ENOENT;
+        path = get_path(f, in->ino);
+        if(path != NULL) {
+            res = -ENOSYS;
+            if(f->op.getdir)
+                res = f->op.getdir(path, &dh, (fuse_dirfil_t) fill_dir);
+            free(path);
+        }
+        fflush(dh.fp);
     }
-    fflush(dh.fp);
-
     memset(&arg, 0, sizeof(struct fuse_getdir_out));
-    arg.fd = fileno(dh.fp);
+    if (res == 0)
+        arg.fd = fileno(dh.fp);
     send_reply(f, in, res, &arg, sizeof(arg));
-    fclose(dh.fp);
+    if (dh.fp != NULL)
+        fclose(dh.fp);
 }
 
 static void do_mknod(struct fuse *f, struct fuse_in_header *in,