Cache vnode member variables necessary for operations after the

userspace call, namely our private mount structure, in the activation
record.  This avoids problems in situations where the userspace
file server happens to die during our upcall and the vnode is
forcibly reclaimed before we roll back to the current stack frame.
This commit is contained in:
pooka 2007-10-11 12:31:45 +00:00
parent d8d3327f01
commit bbaa4c8c80
2 changed files with 13 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vfsops.c,v 1.61 2007/10/09 20:57:07 pooka Exp $ */
/* $NetBSD: puffs_vfsops.c,v 1.62 2007/10/11 12:31:45 pooka Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.61 2007/10/09 20:57:07 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.62 2007/10/11 12:31:45 pooka Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@ -529,6 +529,7 @@ int
puffs_sync(struct mount *mp, int waitfor, struct kauth_cred *cred,
struct lwp *l)
{
struct puffs_mount *pmp = MPTOPUFFSMP(mp);
int error, rv;
PUFFS_VFSREQ(sync);
@ -540,9 +541,8 @@ puffs_sync(struct mount *mp, int waitfor, struct kauth_cred *cred,
puffs_credcvt(&sync_arg.pvfsr_cred, cred);
puffs_cidcvt(&sync_arg.pvfsr_cid, l);
rv = puffs_vfstouser(MPTOPUFFSMP(mp), PUFFS_VFS_SYNC,
&sync_arg, sizeof(sync_arg));
rv = checkerr(MPTOPUFFSMP(mp), rv, __func__);
rv = puffs_vfstouser(pmp, PUFFS_VFS_SYNC, &sync_arg, sizeof(sync_arg));
rv = checkerr(pmp, rv, __func__);
if (rv)
error = rv;

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vnops.c,v 1.105 2007/10/10 20:42:24 ad Exp $ */
/* $NetBSD: puffs_vnops.c,v 1.106 2007/10/11 12:31:45 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.105 2007/10/10 20:42:24 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.106 2007/10/11 12:31:45 pooka Exp $");
#include <sys/param.h>
#include <sys/fstrans.h>
@ -841,6 +841,7 @@ puffs_dosetattr(struct vnode *vp, struct vattr *vap, kauth_cred_t cred,
struct lwp *l, int chsize)
{
struct puffs_node *pn = vp->v_data;
struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
int error;
PUFFS_VNREQ(setattr);
@ -881,9 +882,9 @@ puffs_dosetattr(struct vnode *vp, struct vattr *vap, kauth_cred_t cred,
puffs_credcvt(&setattr_arg.pvnr_cred, cred);
puffs_cidcvt(&setattr_arg.pvnr_cid, l);
error = puffs_vntouser(MPTOPUFFSMP(vp->v_mount), PUFFS_VN_SETATTR,
error = puffs_vntouser(pmp, PUFFS_VN_SETATTR,
&setattr_arg, sizeof(setattr_arg), 0, vp, NULL);
error = checkerr(MPTOPUFFSMP(vp->v_mount), error, __func__);
error = checkerr(pmp, error, __func__);
if (error)
return error;
@ -1313,6 +1314,7 @@ puffs_seek(void *v)
kauth_cred_t a_cred;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
int error;
PUFFS_VNREQ(seek);
@ -1325,9 +1327,9 @@ puffs_seek(void *v)
* XXX: seems like seek is called with an unlocked vp, but
* it can't hurt to play safe
*/
error = puffs_vntouser(MPTOPUFFSMP(vp->v_mount), PUFFS_VN_SEEK,
error = puffs_vntouser(pmp, PUFFS_VN_SEEK,
&seek_arg, sizeof(seek_arg), 0, vp, NULL);
return checkerr(MPTOPUFFSMP(vp->v_mount), error, __func__);
return checkerr(pmp, error, __func__);
}
static int