Make puffs_updatenode() take a puffs_node instead of a vnode. This
way we don't need to worry if a vnode has been reclaimed from under us.
This commit is contained in:
parent
63e9f065b3
commit
61b1e9a615
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: puffs_node.c,v 1.7 2007/11/16 20:32:17 pooka Exp $ */
|
||||
/* $NetBSD: puffs_node.c,v 1.8 2007/11/17 21:55:29 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_node.c,v 1.7 2007/11/16 20:32:17 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.8 2007/11/17 21:55:29 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/hash.h>
|
||||
@ -466,15 +466,13 @@ puffs_cookie2vnode(struct puffs_mount *pmp, void *cookie, int lock,
|
||||
}
|
||||
|
||||
void
|
||||
puffs_updatenode(struct vnode *vp, int flags)
|
||||
puffs_updatenode(struct puffs_node *pn, int flags, voff_t size)
|
||||
{
|
||||
struct puffs_node *pn;
|
||||
struct timespec ts;
|
||||
|
||||
if (flags == 0)
|
||||
return;
|
||||
|
||||
pn = VPTOPP(vp);
|
||||
nanotime(&ts);
|
||||
|
||||
if (flags & PUFFS_UPDATEATIME) {
|
||||
@ -490,7 +488,7 @@ puffs_updatenode(struct vnode *vp, int flags)
|
||||
pn->pn_stat |= PNODE_METACACHE_MTIME;
|
||||
}
|
||||
if (flags & PUFFS_UPDATESIZE) {
|
||||
pn->pn_mc_size = vp->v_size;
|
||||
pn->pn_mc_size = size;
|
||||
pn->pn_stat |= PNODE_METACACHE_SIZE;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: puffs_subr.c,v 1.59 2007/11/17 18:09:04 pooka Exp $ */
|
||||
/* $NetBSD: puffs_subr.c,v 1.60 2007/11/17 21:55:29 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_subr.c,v 1.59 2007/11/17 18:09:04 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_subr.c,v 1.60 2007/11/17 21:55:29 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -210,7 +210,7 @@ puffs_gop_markupdate(struct vnode *vp, int flags)
|
||||
if (flags & GOP_UPDATE_MODIFIED)
|
||||
uflags |= PUFFS_UPDATEMTIME;
|
||||
|
||||
puffs_updatenode(vp, uflags);
|
||||
puffs_updatenode(VPTOPP(vp), uflags, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: puffs_sys.h,v 1.63 2007/11/17 18:09:04 pooka Exp $ */
|
||||
/* $NetBSD: puffs_sys.h,v 1.64 2007/11/17 21:55:29 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
@ -235,7 +235,7 @@ void puffs_gop_markupdate(struct vnode *, int);
|
||||
|
||||
void puffs_senderr(struct puffs_mount *, int, int, const char *, void *);
|
||||
|
||||
void puffs_updatenode(struct vnode *, int);
|
||||
void puffs_updatenode(struct puffs_node *, int, voff_t);
|
||||
#define PUFFS_UPDATEATIME 0x01
|
||||
#define PUFFS_UPDATECTIME 0x02
|
||||
#define PUFFS_UPDATEMTIME 0x04
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: puffs_vnops.c,v 1.116 2007/11/17 21:30:48 pooka Exp $ */
|
||||
/* $NetBSD: puffs_vnops.c,v 1.117 2007/11/17 21:55:29 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.116 2007/11/17 21:30:48 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.117 2007/11/17 21:55:29 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/fstrans.h>
|
||||
@ -1614,11 +1614,9 @@ puffs_link(void *v)
|
||||
/*
|
||||
* XXX: stay in touch with the cache. I don't like this, but
|
||||
* don't have a better solution either. See also puffs_rename().
|
||||
*
|
||||
* XXX2: can't use vp safely here
|
||||
*/
|
||||
if (error == 0)
|
||||
puffs_updatenode(vp, PUFFS_UPDATECTIME);
|
||||
puffs_updatenode(pn, PUFFS_UPDATECTIME, 0);
|
||||
|
||||
PNBUF_PUT(cnp->cn_pnbuf);
|
||||
RELEPN_AND_VP(dvp, dpn);
|
||||
@ -1736,6 +1734,7 @@ puffs_rename(void *v)
|
||||
} */ *ap = v;
|
||||
PUFFS_MSG_VARS(vn, rename);
|
||||
struct vnode *fdvp = ap->a_fdvp;
|
||||
struct puffs_node *fpn = ap->a_fvp->v_data;
|
||||
struct puffs_mount *pmp = MPTOPUFFSMP(fdvp->v_mount);
|
||||
int error;
|
||||
|
||||
@ -1766,7 +1765,7 @@ puffs_rename(void *v)
|
||||
* don't have a better solution either. See also puffs_link().
|
||||
*/
|
||||
if (error == 0)
|
||||
puffs_updatenode(ap->a_fvp, PUFFS_UPDATECTIME);
|
||||
puffs_updatenode(fpn, PUFFS_UPDATECTIME, 0);
|
||||
|
||||
out:
|
||||
PUFFS_MSG_RELEASE(rename);
|
||||
@ -1839,7 +1838,7 @@ puffs_read(void *v)
|
||||
}
|
||||
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
|
||||
puffs_updatenode(vp, PUFFS_UPDATEATIME);
|
||||
puffs_updatenode(VPTOPP(vp), PUFFS_UPDATEATIME, 0);
|
||||
} else {
|
||||
/*
|
||||
* in case it's not a regular file or we're operating
|
||||
@ -1999,7 +1998,7 @@ puffs_write(void *v)
|
||||
round_page(uio->uio_offset), PGO_CLEANIT);
|
||||
}
|
||||
|
||||
puffs_updatenode(vp, uflags);
|
||||
puffs_updatenode(VPTOPP(vp), uflags, vp->v_size);
|
||||
} else {
|
||||
/* tomove is non-increasing */
|
||||
tomove = PUFFS_TOMOVE(uio->uio_resid, pmp);
|
||||
@ -2658,7 +2657,7 @@ puffs_spec_read(void *v)
|
||||
kauth_cred_t a_cred;
|
||||
} */ *ap = v;
|
||||
|
||||
puffs_updatenode(ap->a_vp, PUFFS_UPDATEATIME);
|
||||
puffs_updatenode(VPTOPP(ap->a_vp), PUFFS_UPDATEATIME, 0);
|
||||
return VOCALL(spec_vnodeop_p, VOFFSET(vop_read), v);
|
||||
}
|
||||
|
||||
@ -2673,7 +2672,7 @@ puffs_spec_write(void *v)
|
||||
kauth_cred_t a_cred;
|
||||
} */ *ap = v;
|
||||
|
||||
puffs_updatenode(ap->a_vp, PUFFS_UPDATEMTIME);
|
||||
puffs_updatenode(VPTOPP(ap->a_vp), PUFFS_UPDATEMTIME, 0);
|
||||
return VOCALL(spec_vnodeop_p, VOFFSET(vop_write), v);
|
||||
}
|
||||
|
||||
@ -2688,7 +2687,7 @@ puffs_fifo_read(void *v)
|
||||
kauth_cred_t a_cred;
|
||||
} */ *ap = v;
|
||||
|
||||
puffs_updatenode(ap->a_vp, PUFFS_UPDATEATIME);
|
||||
puffs_updatenode(VPTOPP(ap->a_vp), PUFFS_UPDATEATIME, 0);
|
||||
return VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), v);
|
||||
}
|
||||
|
||||
@ -2703,6 +2702,6 @@ puffs_fifo_write(void *v)
|
||||
kauth_cred_t a_cred;
|
||||
} */ *ap = v;
|
||||
|
||||
puffs_updatenode(ap->a_vp, PUFFS_UPDATEMTIME);
|
||||
puffs_updatenode(VPTOPP(ap->a_vp), PUFFS_UPDATEMTIME, 0);
|
||||
return VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), v);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user