Watch this:
$ doas sshfs natano@localhost:/tmp /mnt
$ cat /mnt/foo
cat: /mnt/foo: No such file or directory
$ echo bar > /tmp/foo
$ cat /mnt/foo
cat: /mnt/foo: No such file or directory
$ touch /mnt/foo
$ cat /mnt/foo
bar
$
There is no sense in doing caching in fusefs. In case of a non-local
filesystem the tree can change behind our back without us having a
chance to purge the cache.
"The only winning move is not to play." Ok?
natano
Index: miscfs/fuse/fuse_lookup.c
===================================================================
RCS file: /cvs/src/sys/miscfs/fuse/fuse_lookup.c,v
retrieving revision 1.12
diff -u -p -r1.12 fuse_lookup.c
--- miscfs/fuse/fuse_lookup.c 12 Aug 2016 20:18:44 -0000 1.12
+++ miscfs/fuse/fuse_lookup.c 15 Aug 2016 10:01:41 -0000
@@ -64,9 +64,6 @@ fusefs_lookup(void *v)
(cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
return (EROFS);
- if ((error = cache_lookup(vdp, vpp, cnp)) >= 0)
- return (error);
-
if (flags & ISDOTDOT) {
/* got ".." */
nid = dp->parent;
@@ -120,10 +117,8 @@ fusefs_lookup(void *v)
* Write access to directory required to delete files.
*/
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
- if (error != 0) {
- fb_delete(fbuf);
- return (error);
- }
+ if (error)
+ goto out;
cnp->cn_flags |= SAVENAME;
}
@@ -132,10 +127,8 @@ fusefs_lookup(void *v)
/*
* Write access to directory required to delete files.
*/
- if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc)) != 0)
{
- fb_delete(fbuf);
- return (error);
- }
+ if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc)) != 0)
+ goto out;
if (nid == VTOI(vdp)->ufs_ino.i_number) {
error = EISDIR;
@@ -187,10 +180,8 @@ fusefs_lookup(void *v)
update_vattr(fmp->mp, &fbuf->fb_vattr);
- if (error) {
- fb_delete(fbuf);
- return (error);
- }
+ if (error)
+ goto out;
if (vdp != NULL && vdp->v_type == VDIR)
VTOI(tdp)->parent = dp->ufs_ino.i_number;
@@ -204,10 +195,6 @@ fusefs_lookup(void *v)
}
out:
- if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE &&
- nameiop != DELETE)
- cache_enter(vdp, *vpp, cnp);
-
fb_delete(fbuf);
return (error);
}
Index: miscfs/fuse/fuse_vnops.c
===================================================================
RCS file: /cvs/src/sys/miscfs/fuse/fuse_vnops.c,v
retrieving revision 1.29
diff -u -p -r1.29 fuse_vnops.c
--- miscfs/fuse/fuse_vnops.c 12 Aug 2016 20:18:44 -0000 1.29
+++ miscfs/fuse/fuse_vnops.c 15 Aug 2016 10:01:41 -0000
@@ -857,7 +857,6 @@ fusefs_reclaim(void *v)
* Remove the inode from its hash chain.
*/
ufs_ihashrem(&ip->ufs_ino);
- cache_purge(vp);
free(ip, M_FUSEFS, 0);
vp->v_data = NULL;
@@ -1386,11 +1385,9 @@ fusefs_rmdir(void *v)
goto out;
}
- cache_purge(dvp);
vput(dvp);
dvp = NULL;
- cache_purge(ITOV(ip));
fb_delete(fbuf);
out:
if (dvp)