From 847e9294c080d2d37a34ca880d93acec719dc036 Mon Sep 17 00:00:00 2001 From: natano Date: Tue, 16 Aug 2016 21:32:58 +0000 Subject: [PATCH] There is no sense in doing caching in fusefs. In case of a non-local filesystem the tree can change behind our back, resulting in stale cache entries. "The only winning move is not to play." ok tedu beck mpi --- sys/miscfs/fuse/fuse_lookup.c | 27 +++++++-------------------- sys/miscfs/fuse/fuse_vnops.c | 5 +---- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/sys/miscfs/fuse/fuse_lookup.c b/sys/miscfs/fuse/fuse_lookup.c index aa33ce5cc0c..ca93c59d186 100644 --- a/sys/miscfs/fuse/fuse_lookup.c +++ b/sys/miscfs/fuse/fuse_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_lookup.c,v 1.12 2016/08/12 20:18:44 natano Exp $ */ +/* $OpenBSD: fuse_lookup.c,v 1.13 2016/08/16 21:32:58 natano Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -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); } diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index 39d8e087643..c73c2e797fe 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.29 2016/08/12 20:18:44 natano Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.30 2016/08/16 21:32:58 natano Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -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) -- 2.20.1