diff options
author | Sylvestre Gallon <syl@cvs.openbsd.org> | 2014-02-01 09:30:39 +0000 |
---|---|---|
committer | Sylvestre Gallon <syl@cvs.openbsd.org> | 2014-02-01 09:30:39 +0000 |
commit | fa66a94f59187b0061576adb68bea2883546c14d (patch) | |
tree | fe7a847a07cbd06a1da8ce72c7c941923569478d /sys/miscfs | |
parent | b3dcce1baf414f4566a23c101f9859fd772846a2 (diff) |
Replace the vnode struct vattr cache by VOP_GETATTR() calls.
ok tedu@
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/fuse/fuse_lookup.c | 4 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_vnops.c | 22 | ||||
-rw-r--r-- | sys/miscfs/fuse/fusefs_node.h | 3 |
3 files changed, 17 insertions, 12 deletions
diff --git a/sys/miscfs/fuse/fuse_lookup.c b/sys/miscfs/fuse/fuse_lookup.c index c7f61766b07..1af2144d003 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.7 2013/12/03 09:32:23 syl Exp $ */ +/* $OpenBSD: fuse_lookup.c,v 1.8 2014/02/01 09:30:38 syl Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -187,8 +187,6 @@ fusefs_lookup(void *v) } update_vattr(fmp->mp, &fbuf->fb_vattr); - memcpy(&(VTOI(tdp)->cached_attrs), &fbuf->fb_vattr, - sizeof(struct vattr)); if (error) { fb_delete(fbuf); diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index f5fb08a6dd5..43053518dfc 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.14 2014/01/29 20:37:18 syl Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.15 2014/02/01 09:30:38 syl Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -280,12 +280,15 @@ fusefs_access(void *v) struct fusefs_node *ip; struct fusefs_mnt *fmp; struct fusebuf *fbuf; + struct ucred *cred; + struct vattr vattr; struct proc *p; uint32_t mask = 0; int error = 0; ap = v; p = ap->a_p; + cred = p->p_ucred; ip = VTOI(ap->a_vp); fmp = (struct fusefs_mnt *)ip->ufs_ino.i_ump; @@ -330,8 +333,11 @@ fusefs_access(void *v) return (error); system_check: - return (vaccess(ap->a_vp->v_type, ip->cached_attrs.va_mode & ALLPERMS, - ip->cached_attrs.va_uid, ip->cached_attrs.va_gid, ap->a_mode, + if ((error = VOP_GETATTR(ap->a_vp, &vattr, cred, p)) != 0) + return (error); + + return (vaccess(ap->a_vp->v_type, vattr.va_mode & ALLPERMS, + vattr.va_uid, vattr.va_gid, ap->a_mode, ap->a_cred)); } @@ -363,7 +369,6 @@ fusefs_getattr(void *v) update_vattr(fmp->mp, &fbuf->fb_vattr); memcpy(vap, &fbuf->fb_vattr, sizeof(*vap)); - memcpy(&ip->cached_attrs, vap, sizeof(*vap)); fb_delete(fbuf); return (error); fake: @@ -693,9 +698,11 @@ fusefs_inactive(void *v) struct vop_inactive_args *ap = v; struct vnode *vp = ap->a_vp; struct proc *p = ap->a_p; + struct ucred *cred = p->p_ucred; struct fusefs_node *ip = VTOI(vp); struct fusefs_filehandle *fufh = NULL; struct fusefs_mnt *fmp; + struct vattr vattr; int error = 0; int type; @@ -708,13 +715,14 @@ fusefs_inactive(void *v) (ip->vtype == VDIR), ap->a_p); } + error = VOP_GETATTR(vp, &vattr, cred, p); + VOP_UNLOCK(vp, 0, p); - /* not sure if it is ok to do like that ...*/ - if (ip->cached_attrs.va_mode == 0) + if (error) vrecycle(vp, p); - return (error); + return (0); } int diff --git a/sys/miscfs/fuse/fusefs_node.h b/sys/miscfs/fuse/fusefs_node.h index 0aef7b80bfe..d3c146daa00 100644 --- a/sys/miscfs/fuse/fusefs_node.h +++ b/sys/miscfs/fuse/fusefs_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fusefs_node.h,v 1.1 2013/06/03 15:50:56 tedu Exp $ */ +/* $OpenBSD: fusefs_node.h,v 1.2 2014/02/01 09:30:38 syl Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -45,7 +45,6 @@ struct fusefs_node { struct fusefs_filehandle fufh[FUFH_MAXTYPE]; /** meta **/ - struct vattr cached_attrs; off_t filesize; uint64_t nlookup; enum vtype vtype; |