fixes
authorMiklos Szeredi <miklos@szeredi.hu>
Sat, 11 Nov 2006 09:55:55 +0000 (09:55 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Sat, 11 Nov 2006 09:55:55 +0000 (09:55 +0000)
ChangeLog
include/fuse.h
lib/fuse.c
lib/fuse_lowlevel.c
lib/helper.c

index 5e0b3001701f6663b2be71373346bf120fcca2e3..24d143f05ef28be50651d8385a6269cbbea94180 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-11-11  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Print an error if an incompatible kernel interface version is
+       detected in INIT.  This will only show if filesystem is started
+       with -d or -f
+
+       * Fix order of fuse_destroy()/fuse_unmount() in error cleanup of
+       fuse_setup_common().  Reported by Szakacsits Szabolcs
+
+2006-11-06  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Fix recursive locking in fuse_create().  Thanks to Takuya
+       Ishibashi for the bug report
+
 2006-10-28  Miklos Szeredi <miklos@szeredi.hu>
 
        * Fix automake problem.  Patch from Nix
index 6af2c4fdb1bc7077ee6255a2e491b1cfd97b9030..15312968cdd4d413ac997c20dc655905609b81ca 100644 (file)
@@ -495,7 +495,10 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
 /**
  * Destroy the FUSE handle.
  *
- * The filesystem is not unmounted.
+ * The communication channel attached to the handle is also destroyed.
+ *
+ * NOTE: This function does not unmount the filesystem.  If this is
+ * needed, call fuse_unmount() before calling this function.
  *
  * @param f the FUSE handle
  */
index 6de98faef93ac7a8fc5fe4ff3563b0570f99d5da..4446245096dc44935a05ff4dad56baee912a84b2 100644 (file)
@@ -1442,12 +1442,13 @@ static void fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
             /* The open syscall was interrupted, so it must be cancelled */
             if(f->op.release)
                 fuse_do_release(f, req, path, fi);
+            pthread_mutex_unlock(&f->lock);
             forget_node(f, e.ino, 1);
         } else {
             struct node *node = get_node(f, e.ino);
             node->open_count ++;
+            pthread_mutex_unlock(&f->lock);
         }
-        pthread_mutex_unlock(&f->lock);
     } else
         reply_err(req, err);
 
index 05d99e13728132a942f28e80749595addd4ee487..98738e4d77a6c993f8ff3db96f2314575d7c32d8 100644 (file)
@@ -952,6 +952,13 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
     f->conn.proto_major = arg->major;
     f->conn.proto_minor = arg->minor;
 
+    if (arg->major < 7) {
+        fprintf(stderr, "fuse: unsupported protocol version: %u.%u\n",
+                arg->major, arg->minor);
+        fuse_reply_err(req, EPROTO);
+        return;
+    }
+
     if (arg->major > 7 || (arg->major == 7 && arg->minor >= 6)) {
         if (f->conn.async_read)
             f->conn.async_read = arg->flags & FUSE_ASYNC_READ;
index b6925d45602b5bc212df7812aee84f4ecbf17f79..63aefd51b3f0012dbe7ad6fa2a8586d388a899eb 100644 (file)
@@ -255,21 +255,21 @@ static struct fuse *fuse_setup_common(int argc, char *argv[],
 
     res = fuse_daemonize(foreground);
     if (res == -1)
-        goto err_destroy;
+        goto err_unmount;
 
     res = fuse_set_signal_handlers(fuse_get_session(fuse));
     if (res == -1)
-        goto err_destroy;
+        goto err_unmount;
 
     if (fd)
         *fd = fuse_chan_fd(ch);
 
     return fuse;
 
- err_destroy:
-    fuse_destroy(fuse);
  err_unmount:
     fuse_unmount_common(*mountpoint, ch);
+    if (fuse)
+        fuse_destroy(fuse);
  err_free:
     free(*mountpoint);
     return NULL;