diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2022-08-12 14:30:54 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2022-08-12 14:30:54 +0000 |
commit | c5809ba8cfd83d3a6df37582a7645dc07eb9240e (patch) | |
tree | 7138877aee9c5073e1f77d3506a754eaabdd303e /sys/ufs | |
parent | bfa0919b6d8400e745b440c872c27eb4dfabd548 (diff) |
Put more struct vnode fields under splbio().
Buffer cache related struct vnode fields can be accessed in interrupt
context. Be more consistent with the use of splbio().
OK mpi@
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_inode.c | 15 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vfsops.c | 10 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 10 |
3 files changed, 26 insertions, 9 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index 5c76a5956b3..2962628f865 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -387,10 +387,15 @@ done: 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. diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 371ca53f096..af3f0a9ab33 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -713,6 +713,7 @@ ext2fs_sync_vnode(struct vnode *vp, void *args) struct ext2fs_sync_args *esa = args; struct inode *ip; int error, nlink0 = 0; + int s, skip = 0; if (vp->v_type == VNON) return (0); @@ -722,10 +723,15 @@ ext2fs_sync_vnode(struct vnode *vp, void *args) 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); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index b513a271877..730a36b0fab 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -1159,6 +1159,7 @@ ffs_sync_vnode(struct vnode *vp, void *arg) struct ffs_sync_args *fsa = arg; struct inode *ip; int error, nlink0 = 0; + int s, skip = 0; if (vp->v_type == VNON) return (0); @@ -1177,11 +1178,16 @@ ffs_sync_vnode(struct vnode *vp, void *arg) 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); |