passthrough, passthrough_fh: disable attribute caching
authorNikolaus Rath <Nikolaus@rath.org>
Thu, 6 Apr 2017 18:47:06 +0000 (11:47 -0700)
committerNikolaus Rath <Nikolaus@rath.org>
Fri, 7 Apr 2017 23:40:15 +0000 (16:40 -0700)
Required for better hardlink handling, see comments in patch.

example/passthrough.c
example/passthrough_fh.c

index 15f424a8b3f1a8a8d38c00e364b2ae7b62a92487..22e7083e6b20d876eaf7107f801d1a52633c8f05 100644 (file)
@@ -52,6 +52,18 @@ static void *xmp_init(struct fuse_conn_info *conn,
 {
        (void) conn;
        cfg->use_ino = 1;
+
+       /* Pick up changes from lower filesystem right away. This is
+          also necessary for better hardlink support. When the kernel
+          calls the unlink() handler, it does not know the inode of
+          the to-be-removed entry and can therefore not invalidate
+          the cache of the associated inode - resulting in an
+          incorrect st_nlink value being reported for any remaining
+          hardlinks to this inode. */
+       cfg->entry_timeout = 0;
+       cfg->attr_timeout = 0;
+       cfg->negative_timeout = 0;
+
        return NULL;
 }
 
index c807d752f78f825aee7f1d33aa835274dffba89e..372282ed66f558cf34ddb2cb3ab55b93ac679312 100644 (file)
@@ -57,6 +57,18 @@ static void *xmp_init(struct fuse_conn_info *conn,
        (void) conn;
        cfg->use_ino = 1;
        cfg->nullpath_ok = 1;
+
+       /* Pick up changes from lower filesystem right away. This is
+          also necessary for better hardlink support. When the kernel
+          calls the unlink() handler, it does not know the inode of
+          the to-be-removed entry and can therefore not invalidate
+          the cache of the associated inode - resulting in an
+          incorrect st_nlink value being reported for any remaining
+          hardlinks to this inode. */
+       cfg->entry_timeout = 0;
+       cfg->attr_timeout = 0;
+       cfg->negative_timeout = 0;
+
        return NULL;
 }