summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Evans-Cole <spencer.ec09@gmail.com>2022-03-03 16:28:24 -0500
committerDan McDonald <danmcd@joyent.com>2022-03-07 11:00:17 -0500
commitace00d929c2577892f2f9f468c3298cb1e2da762 (patch)
treeac15c4163e2aa1d327e7252ff72d95ce65bfe2de
parent80e685ca4539785ad0b647ce5cef5d5f8b79ed6f (diff)
downloadillumos-joyent-ace00d929c2577892f2f9f468c3298cb1e2da762.tar.gz
11679 vn_rele() and friends should VERIFY after mutex
Reviewed by: Dan McDonald <danmcd@joyent.com> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com> (Early pull into SmartOS)
-rw-r--r--usr/src/uts/common/fs/vnode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c
index e1359f47de..953ee80471 100644
--- a/usr/src/uts/common/fs/vnode.c
+++ b/usr/src/uts/common/fs/vnode.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2020 Joyent, Inc.
+ * Copyright 2022 Spencer Evans-Cole.
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
* Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
@@ -843,13 +844,13 @@ done:
void
vn_rele(vnode_t *vp)
{
- VERIFY(vp->v_count > 0);
mutex_enter(&vp->v_lock);
if (vp->v_count == 1) {
mutex_exit(&vp->v_lock);
VOP_INACTIVE(vp, CRED(), NULL);
return;
}
+ VERIFY(vp->v_count > 0);
VN_RELE_LOCKED(vp);
mutex_exit(&vp->v_lock);
}
@@ -857,8 +858,6 @@ vn_rele(vnode_t *vp)
void
vn_phantom_rele(vnode_t *vp)
{
- VERIFY(vp->v_count > 0);
-
mutex_enter(&vp->v_lock);
VERIFY3U(vp->v_count, >=, vp->v_phantom_count);
vp->v_phantom_count--;
@@ -869,6 +868,7 @@ vn_phantom_rele(vnode_t *vp)
VOP_INACTIVE(vp, CRED(), NULL);
return;
}
+ VERIFY(vp->v_count > 0);
VN_RELE_LOCKED(vp);
mutex_exit(&vp->v_lock);
}
@@ -894,8 +894,8 @@ vn_count(vnode_t *vp)
void
vn_rele_dnlc(vnode_t *vp)
{
- VERIFY((vp->v_count > 0) && (vp->v_count_dnlc > 0));
mutex_enter(&vp->v_lock);
+ VERIFY((vp->v_count > 0) && (vp->v_count_dnlc > 0));
if (--vp->v_count_dnlc == 0) {
if (vp->v_count == 1) {
mutex_exit(&vp->v_lock);
@@ -917,7 +917,6 @@ vn_rele_dnlc(vnode_t *vp)
void
vn_rele_stream(vnode_t *vp)
{
- VERIFY(vp->v_count > 0);
mutex_enter(&vp->v_lock);
vp->v_stream = NULL;
if (vp->v_count == 1) {
@@ -925,6 +924,7 @@ vn_rele_stream(vnode_t *vp)
VOP_INACTIVE(vp, CRED(), NULL);
return;
}
+ VERIFY(vp->v_count > 0);
VN_RELE_LOCKED(vp);
mutex_exit(&vp->v_lock);
}
@@ -948,7 +948,6 @@ vn_rele_inactive(vnode_t *vp)
void
vn_rele_async(vnode_t *vp, taskq_t *taskq)
{
- VERIFY(vp->v_count > 0);
mutex_enter(&vp->v_lock);
if (vp->v_count == 1) {
mutex_exit(&vp->v_lock);
@@ -956,6 +955,7 @@ vn_rele_async(vnode_t *vp, taskq_t *taskq)
vp, TQ_SLEEP) != TASKQID_INVALID);
return;
}
+ VERIFY(vp->v_count > 0);
VN_RELE_LOCKED(vp);
mutex_exit(&vp->v_lock);
}