-/* $OpenBSD: vfs_bio.c,v 1.208 2021/12/12 09:14:59 visa Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.209 2022/08/12 14:30:52 visa Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
void
-discard_buffer(struct buf *bp) {
+discard_buffer(struct buf *bp)
+{
+ splassert(IPL_BIO);
+
bufcache_take(bp);
if (bp->b_vp) {
RBT_REMOVE(buf_rb_bufs,
-/* $OpenBSD: vfs_subr.c,v 1.315 2022/03/27 16:19:39 semarie Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.316 2022/08/12 14:30:52 visa Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
}
mtx_leave(&vnode_mtx);
+ s = splbio();
onfreelist = vp->v_bioflag & VBIOONFREELIST;
if (vp->v_usecount == 0 && onfreelist) {
- s = splbio();
if (vp->v_holdcnt > 0)
TAILQ_REMOVE(&vnode_hold_list, vp, v_freelist);
else
TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
vp->v_bioflag &= ~VBIOONFREELIST;
- splx(s);
}
+ splx(s);
vp->v_usecount++;
if (flags & LK_TYPE_MASK) {
vput(struct vnode *vp)
{
struct proc *p = curproc;
+ int s;
#ifdef DIAGNOSTIC
if (vp == NULL)
VOP_INACTIVE(vp, p);
+ s = splbio();
if (vp->v_usecount == 0 && !(vp->v_bioflag & VBIOONFREELIST))
vputonfreelist(vp);
+ splx(s);
}
/*
vrele(struct vnode *vp)
{
struct proc *p = curproc;
+ int s;
#ifdef DIAGNOSTIC
if (vp == NULL)
VOP_INACTIVE(vp, p);
+ s = splbio();
if (vp->v_usecount == 0 && !(vp->v_bioflag & VBIOONFREELIST))
vputonfreelist(vp);
+ splx(s);
return (1);
}
void
vhold(struct vnode *vp)
{
+ int s;
+
+ s = splbio();
+
/*
* If it is on the freelist and the hold count is currently
* zero, move it to the hold list.
TAILQ_INSERT_TAIL(&vnode_hold_list, vp, v_freelist);
}
vp->v_holdcnt++;
+
+ splx(s);
}
/* Lose interest in a vnode. */
void
vdrop(struct vnode *vp)
{
+ int s;
+
+ s = splbio();
+
#ifdef DIAGNOSTIC
if (vp->v_holdcnt == 0)
panic("vdrop: zero holdcnt");
TAILQ_REMOVE(&vnode_hold_list, vp, v_freelist);
TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
}
+
+ splx(s);
}
/*
{
struct vflush_args *va = arg;
struct proc *p = curproc;
+ int empty, s;
if (vp == va->skipvp) {
return (0);
* XXX Might be nice to check per-fs "inode" flags, but
* generally the filesystem is sync'd already, right?
*/
- if ((va->flags & IGNORECLEAN) &&
- LIST_EMPTY(&vp->v_dirtyblkhd))
+ s = splbio();
+ empty = (va->flags & IGNORECLEAN) && LIST_EMPTY(&vp->v_dirtyblkhd);
+ splx(s);
+
+ if (empty)
return (0);
#ifdef DEBUG_SYSCTL
vclean(struct vnode *vp, int flags, struct proc *p)
{
int active, do_wakeup = 0;
+ int s;
/*
* Check to see if the vnode is in use.
if (active) {
vp->v_usecount--;
if (vp->v_usecount == 0) {
+ s = splbio();
if (vp->v_holdcnt > 0)
panic("vclean: not clean");
vputonfreelist(vp);
+ splx(s);
}
}
cache_purge(vp);
{
struct vnode *vq;
struct vnode *vx;
+ int s;
KASSERT(vp->v_uvcount == 0);
* Move onto the free list, unless we were called from
* getnewvnode and we're not on any free list
*/
+ s = splbio();
if (vp->v_usecount == 0 &&
(vp->v_bioflag & VBIOONFREELIST)) {
- int s;
-
- s = splbio();
-
if (vp->v_holdcnt > 0)
panic("vgonel: not clean");
TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist);
}
- splx(s);
}
+ splx(s);
}
/*
-/* $OpenBSD: msdosfs_vfsops.c,v 1.95 2021/11/13 18:18:59 kn Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.96 2022/08/12 14:30:52 visa Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */
/*-
msdosfs_sync_vnode(struct vnode *vp, void *arg)
{
struct msdosfs_sync_arg *msa = arg;
- int error;
struct denode *dep;
+ int error;
+ int s, skip = 0;
dep = VTODE(vp);
+ s = splbio();
if (vp->v_type == VNON ||
((dep->de_flag & (DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0
&& LIST_EMPTY(&vp->v_dirtyblkhd)) ||
msa->waitfor == MNT_LAZY) {
- return (0);
+ skip = 1;
}
+ splx(s);
+
+ if (skip)
+ return (0);
if (vget(vp, LK_EXCLUSIVE | LK_NOWAIT))
return (0);
-/* $OpenBSD: nfs_vfsops.c,v 1.126 2021/01/02 02:41:42 cheloha Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.127 2022/08/12 14:30:53 visa Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
nfs_sync(struct mount *mp, int waitfor, int stall, struct ucred *cred, struct proc *p)
{
struct vnode *vp;
- int error, allerror = 0;
+ int allerror = 0;
+ int empty, error, s;
/*
* Don't traverse the vnode list if we want to skip all of them.
*/
if (vp->v_mount != mp)
goto loop;
- if (VOP_ISLOCKED(vp) || LIST_EMPTY(&vp->v_dirtyblkhd))
+ if (VOP_ISLOCKED(vp))
+ continue;
+ s = splbio();
+ empty = LIST_EMPTY(&vp->v_dirtyblkhd);
+ splx(s);
+ if (empty)
continue;
if (vget(vp, LK_EXCLUSIVE))
goto loop;
-/* $OpenBSD: nfs_vnops.c,v 1.189 2022/06/26 05:20:42 visa Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.190 2022/08/12 14:30:53 visa Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
uint64_t slptimeo = INFSLP;
int s, error = 0, slpflag = 0, retv, bvecpos;
- int passone = 1;
+ int dirty, passone = 1;
u_quad_t off = (u_quad_t)-1, endoff = 0, toff;
#ifndef NFS_COMMITBVECSIZ
#define NFS_COMMITBVECSIZ 20
loop2:
s = splbio();
error = vwaitforio(vp, slpflag, "nfs_fsync", slptimeo);
- splx(s);
if (error) {
+ splx(s);
if (nfs_sigintr(nmp, NULL, p))
return (EINTR);
if (slpflag == PCATCH) {
}
goto loop2;
}
-
- if (!LIST_EMPTY(&vp->v_dirtyblkhd) && commit) {
+ dirty = (!LIST_EMPTY(&vp->v_dirtyblkhd) && commit);
+ splx(s);
+ if (dirty) {
#if 0
vprint("nfs_fsync: dirty", vp);
#endif
-/* $OpenBSD: vnode.h,v 1.166 2022/06/26 05:20:42 visa Exp $ */
+/* $OpenBSD: vnode.h,v 1.167 2022/08/12 14:30:53 visa Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
u_int v_writecount; /* reference count of writers */
u_int v_lockcount; /* [V] # threads waiting on lock */
- /* Flags that can be read/written in interrupts */
- u_int v_bioflag;
- u_int v_holdcnt; /* buffer references */
+ u_int v_bioflag; /* [B] flags accessed in interrupts */
+ u_int v_holdcnt; /* [B] buffer references */
u_int v_id; /* capability identifier */
struct mount *v_mount; /* ptr to vfs we are in */
- TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */
+ TAILQ_ENTRY(vnode) v_freelist; /* [B] vnode freelist */
TAILQ_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */
- struct buf_rb_bufs v_bufs_tree; /* lookup of all bufs */
- struct buflists v_cleanblkhd; /* clean blocklist head */
- struct buflists v_dirtyblkhd; /* dirty blocklist head */
+ struct buf_rb_bufs v_bufs_tree;/* [B] lookup of all bufs */
+ struct buflists v_cleanblkhd; /* [B] clean blocklist head */
+ struct buflists v_dirtyblkhd; /* [B] dirty blocklist head */
u_int v_numoutput; /* [B] num of writes in progress */
- LIST_ENTRY(vnode) v_synclist; /* vnode with dirty buffers */
+ LIST_ENTRY(vnode) v_synclist; /* [B] vnode with dirty buffers */
union {
struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */
struct socket *vu_socket; /* unix ipc (VSOCK) */
-/* $OpenBSD: ext2fs_inode.c,v 1.65 2021/12/12 09:14:59 visa Exp $ */
+/* $OpenBSD: ext2fs_inode.c,v 1.66 2022/08/12 14:30:53 visa Exp $ */
/* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */
/*
for (i = 0; i < NDADDR; i++)
if (newblks[i] != oip->i_e2fs_blocks[i])
panic("ext2fs_truncate2");
- if (length == 0 &&
- (!LIST_EMPTY(&ovp->v_cleanblkhd) ||
- !LIST_EMPTY(&ovp->v_dirtyblkhd)))
- panic("ext2fs_truncate3");
+ if (length == 0) {
+ int s;
+
+ s = splbio();
+ if (!LIST_EMPTY(&ovp->v_cleanblkhd) ||
+ !LIST_EMPTY(&ovp->v_dirtyblkhd))
+ panic("ext2fs_truncate3");
+ splx(s);
+ }
#endif /* DIAGNOSTIC */
/*
* Put back the real size.
-/* $OpenBSD: ext2fs_vfsops.c,v 1.116 2021/10/04 08:11:02 claudio Exp $ */
+/* $OpenBSD: ext2fs_vfsops.c,v 1.117 2022/08/12 14:30:53 visa Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */
/*
struct ext2fs_sync_args *esa = args;
struct inode *ip;
int error, nlink0 = 0;
+ int s, skip = 0;
if (vp->v_type == VNON)
return (0);
if (ip->i_e2fs_nlink == 0)
nlink0 = 1;
+ s = splbio();
if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
LIST_EMPTY(&vp->v_dirtyblkhd)) {
- goto end;
+ skip = 1;
}
+ splx(s);
+
+ if (skip)
+ goto end;
if (vget(vp, LK_EXCLUSIVE | LK_NOWAIT)) {
esa->inflight = MIN(esa->inflight+1, 65536);
-/* $OpenBSD: ffs_vfsops.c,v 1.192 2021/10/20 06:35:39 semarie Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.193 2022/08/12 14:30:53 visa Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
struct ffs_sync_args *fsa = arg;
struct inode *ip;
int error, nlink0 = 0;
+ int s, skip = 0;
if (vp->v_type == VNON)
return (0);
if (ip->i_effnlink == 0)
nlink0 = 1;
+ s = splbio();
if ((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
LIST_EMPTY(&vp->v_dirtyblkhd)) {
- goto end;
+ skip = 1;
}
+ splx(s);
+
+ if (skip)
+ goto end;
if (vget(vp, LK_EXCLUSIVE | LK_NOWAIT)) {
fsa->inflight = MIN(fsa->inflight+1, 65536);