fix
authorMiklos Szeredi <miklos@szeredi.hu>
Sat, 25 Feb 2006 14:42:03 +0000 (14:42 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Sat, 25 Feb 2006 14:42:03 +0000 (14:42 +0000)
ChangeLog
kernel/dir.c
lib/fuse.c
lib/fuse_lowlevel.c

index ddcf7127d34979cab03b47d54ae688fdbe3771ee..43a0e7de59a53f6fd813d2775bc41915523806f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-02-25  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Lowlevel lib: return all-zero statvfs data if filesystem doesn't
+       implement method.  This is needed on FreeBSD, and nicer on Linux
+       too.  Highlevel lib already did this.  Reported by Csaba Henk
+
+       * Fix negative entry handling.  There was a bug, that negative
+       lookups with timeouts (nodeid == 0) returned -EIO.
+
+2006-02-23  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Fix race between RELEASE and UNLINK, which might leave
+       .fuse_hidden* files around
+
 2006-02-21  Miklos Szeredi <miklos@szeredi.hu>
 
        * fusexmp_fh: implement flush() method and call close() on the
index 478f5764bc8defff4e1a79016703792557c2f69f..1cee4a23670c1cacb1710f25dd392097b3cbd9d6 100644 (file)
@@ -117,6 +117,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
 
                /* Doesn't hurt to "reset" the validity timeout */
                fuse_invalidate_entry_cache(entry);
+
+               /* For negative dentries, always do a fresh lookup */
                if (!inode)
                        return 0;
 
@@ -128,6 +130,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
                fuse_lookup_init(req, entry->d_parent->d_inode, entry, &outarg);
                request_send(fc, req);
                err = req->out.h.error;
+               /* Zero nodeid is same as -ENOENT */
+               if (!err && !outarg.nodeid)
+                       err = -ENOENT;
                if (!err) {
                        struct fuse_inode *fi = get_fuse_inode(inode);
                        if (outarg.nodeid != get_node_id(inode)) {
@@ -217,8 +222,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
        fuse_lookup_init(req, dir, entry, &outarg);
        request_send(fc, req);
        err = req->out.h.error;
-       if (!err && ((outarg.nodeid && invalid_nodeid(outarg.nodeid)) ||
-                    !valid_mode(outarg.attr.mode)))
+       /* Zero nodeid is same as -ENOENT, but with valid timeout */
+       if (!err && outarg.nodeid &&
+           (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode)))
                err = -EIO;
        if (!err && outarg.nodeid) {
                inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
index ac6a2d5f4ad4586965bb23e6944d9b38879c3d7c..0b312331002b6bfcdef4f35d900262b556945416 100644 (file)
@@ -1331,6 +1331,7 @@ static void fuse_release(fuse_req_t req, fuse_ino_t ino,
     struct node *node;
     int unlink_hidden;
 
+    pthread_rwlock_rdlock(&f->tree_lock);
     pthread_mutex_lock(&f->lock);
     node = get_node(f, ino);
     assert(node->open_count > 0);
@@ -1338,7 +1339,6 @@ static void fuse_release(fuse_req_t req, fuse_ino_t ino,
     unlink_hidden = (node->is_hidden && !node->open_count);
     pthread_mutex_unlock(&f->lock);
 
-    pthread_rwlock_rdlock(&f->tree_lock);
     path = get_path(f, ino);
     if (f->conf.debug) {
         printf("RELEASE[%llu] flags: 0x%x\n", (unsigned long long) fi->fh,
index 12f6c82407cabc95fa6de5f1e20ed6045c312717..8437eb4ce6da6960826cde4a686d7f099f7836eb 100644 (file)
@@ -653,8 +653,13 @@ static void do_statfs(fuse_req_t req)
 {
     if (req->f->op.statfs)
         req->f->op.statfs(req);
-    else
-        fuse_reply_err(req, ENOSYS);
+    else {
+        struct statvfs buf = {
+            .f_namemax = 255,
+            .f_bsize = 512,
+        };
+        fuse_reply_statfs(req, &buf);
+    }
 }
 
 static void do_setxattr(fuse_req_t req, fuse_ino_t nodeid,