Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs put back UFS_WAPBL_JUNLOCK_ASSERT(), the underlying ...
details: https://anonhg.NetBSD.org/src/rev/7d1d6bc830bd
branches: trunk
changeset: 995176:7d1d6bc830bd
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Dec 10 20:48:34 2018 +0000
description:
put back UFS_WAPBL_JUNLOCK_ASSERT(), the underlying rw_write_held() check
doesn't actually have a race since it checks if the rwlock is held by
current lwp
diffstat:
sys/ufs/ffs/ffs_alloc.c | 6 ++++--
sys/ufs/ufs/ufs_inode.c | 8 ++++++--
sys/ufs/ufs/ufs_readwrite.c | 5 +++--
sys/ufs/ufs/ufs_vnops.c | 8 ++++++--
sys/ufs/ufs/ufs_wapbl.h | 6 +++++-
5 files changed, 24 insertions(+), 9 deletions(-)
diffs (154 lines):
diff -r b28752c9d05b -r 7d1d6bc830bd sys/ufs/ffs/ffs_alloc.c
--- a/sys/ufs/ffs/ffs_alloc.c Mon Dec 10 20:12:36 2018 +0000
+++ b/sys/ufs/ffs/ffs_alloc.c Mon Dec 10 20:48:34 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_alloc.c,v 1.162 2018/12/10 19:29:41 jdolecek Exp $ */
+/* $NetBSD: ffs_alloc.c,v 1.163 2018/12/10 20:48:34 jdolecek Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.162 2018/12/10 19:29:41 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.163 2018/12/10 20:48:34 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -566,6 +566,8 @@
ino_t ino, ipref;
int cg, error;
+ UFS_WAPBL_JUNLOCK_ASSERT(pvp->v_mount);
+
pip = VTOI(pvp);
fs = pip->i_fs;
ump = pip->i_ump;
diff -r b28752c9d05b -r 7d1d6bc830bd sys/ufs/ufs/ufs_inode.c
--- a/sys/ufs/ufs/ufs_inode.c Mon Dec 10 20:12:36 2018 +0000
+++ b/sys/ufs/ufs/ufs_inode.c Mon Dec 10 20:48:34 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_inode.c,v 1.104 2018/12/10 19:29:41 jdolecek Exp $ */
+/* $NetBSD: ufs_inode.c,v 1.105 2018/12/10 20:48:34 jdolecek Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.104 2018/12/10 19:29:41 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.105 2018/12/10 20:48:34 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -86,6 +86,8 @@
int allerror = 0, error;
bool wapbl_locked = false;
+ UFS_WAPBL_JUNLOCK_ASSERT(mp);
+
/*
* Ignore inodes related to stale file handles.
*/
@@ -296,6 +298,8 @@
struct mount *mp = vp->v_mount;
int error = 0;
+ UFS_WAPBL_JUNLOCK_ASSERT(mp);
+
/*
* Truncate might temporarily fail, loop until done.
*/
diff -r b28752c9d05b -r 7d1d6bc830bd sys/ufs/ufs/ufs_readwrite.c
--- a/sys/ufs/ufs/ufs_readwrite.c Mon Dec 10 20:12:36 2018 +0000
+++ b/sys/ufs/ufs/ufs_readwrite.c Mon Dec 10 20:48:34 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_readwrite.c,v 1.122 2018/12/10 19:29:41 jdolecek Exp $ */
+/* $NetBSD: ufs_readwrite.c,v 1.123 2018/12/10 20:48:34 jdolecek Exp $ */
/*-
* Copyright (c) 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.122 2018/12/10 19:29:41 jdolecek Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.123 2018/12/10 20:48:34 jdolecek Exp $");
#ifdef LFS_READWRITE
#define FS struct lfs
@@ -291,6 +291,7 @@
KASSERT(uio->uio_rw == UIO_WRITE);
KASSERT(vp->v_type == VREG);
KASSERT(!ISSET(ioflag, IO_JOURNALLOCKED));
+ UFS_WAPBL_JUNLOCK_ASSERT(vp->v_mount);
if (ioflag & IO_APPEND)
uio->uio_offset = ip->i_size;
diff -r b28752c9d05b -r 7d1d6bc830bd sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c Mon Dec 10 20:12:36 2018 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c Mon Dec 10 20:48:34 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_vnops.c,v 1.240 2018/12/10 19:29:41 jdolecek Exp $ */
+/* $NetBSD: ufs_vnops.c,v 1.241 2018/12/10 20:48:34 jdolecek Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.240 2018/12/10 19:29:41 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.241 2018/12/10 20:48:34 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -460,6 +460,8 @@
return (EINVAL);
}
+ UFS_WAPBL_JUNLOCK_ASSERT(vp->v_mount);
+
if (vap->va_flags != VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY) {
error = EROFS;
@@ -1779,6 +1781,8 @@
struct vnode *tvp;
int error;
+ UFS_WAPBL_JUNLOCK_ASSERT(dvp->v_mount);
+
error = vcache_new(dvp->v_mount, dvp, vap, cnp->cn_cred, &tvp);
if (error)
return error;
diff -r b28752c9d05b -r 7d1d6bc830bd sys/ufs/ufs/ufs_wapbl.h
--- a/sys/ufs/ufs/ufs_wapbl.h Mon Dec 10 20:12:36 2018 +0000
+++ b/sys/ufs/ufs/ufs_wapbl.h Mon Dec 10 20:48:34 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_wapbl.h,v 1.15 2018/12/10 19:29:41 jdolecek Exp $ */
+/* $NetBSD: ufs_wapbl.h,v 1.16 2018/12/10 20:48:34 jdolecek Exp $ */
/*-
* Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -134,8 +134,11 @@
#ifdef DIAGNOSTIC
#define UFS_WAPBL_JLOCK_ASSERT(mp) \
if (mp->mnt_wapbl) wapbl_jlock_assert(mp->mnt_wapbl)
+#define UFS_WAPBL_JUNLOCK_ASSERT(mp) \
+ if (mp->mnt_wapbl) wapbl_junlock_assert(mp->mnt_wapbl)
#else
#define UFS_WAPBL_JLOCK_ASSERT(mp)
+#define UFS_WAPBL_JUNLOCK_ASSERT(mp)
#endif
#define UFS_WAPBL_REGISTER_INODE(mp, ino, mode) \
@@ -165,6 +168,7 @@
#define UFS_WAPBL_END(mp) do { } while (0)
#define UFS_WAPBL_UPDATE(vp, access, modify, flags) do { } while (0)
#define UFS_WAPBL_JLOCK_ASSERT(mp)
+#define UFS_WAPBL_JUNLOCK_ASSERT(mp)
#define UFS_WAPBL_REGISTER_INODE(mp, ino, mode) do { } while (0)
#define UFS_WAPBL_UNREGISTER_INODE(mp, ino, mode) do { } while (0)
#define UFS_WAPBL_REGISTER_DEALLOCATION(mp, blk, len, cookiep) 0
Home |
Main Index |
Thread Index |
Old Index