summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Evans-Cole <spencer.ec09@gmail.com>2022-02-09 17:06:57 -0500
committerDan McDonald <danmcd@joyent.com>2022-03-09 18:10:44 -0500
commit41a4986b48d4a0e9ed138c952a9bad5124a924a6 (patch)
tree848f14789d22885fedd576939e45f2d9dbe2ae6a
parentbf41048984a6ceae3ab49d5d80ce3c32693924b1 (diff)
downloadillumos-joyent-41a4986b48d4a0e9ed138c952a9bad5124a924a6.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> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/uts/common/fs/vnode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c
index 962df4ff50..4e73f7f6e6 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.
*/
@@ -837,13 +838,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,8 @@ vn_rele(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);
@@ -880,7 +881,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) {
@@ -888,6 +888,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);
}
@@ -911,7 +912,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);
@@ -919,6 +919,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);
}