git: 3f10dc83c790 - stable/14 - swapoff: release vnode held since swapon
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Nov 2026 10:26:12 UTC
The branch stable/14 has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=3f10dc83c790e7ae07e2424e8e73e57f839a3e19
commit 3f10dc83c790e7ae07e2424e8e73e57f839a3e19
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-16 09:57:24 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-20 10:25:42 +0000
swapoff: release vnode held since swapon
kern_swapon looks up the proposed swap path and aquires a vnode which is
held (unlocked) throughout the life of the swap device. In the device
case (swapgeom) it was never released in the swapoff path.
Remove an incorrect comment about swapgeom_close being called from
biodone. It is only called directly via swapoff(2) or at the end of the
shutdown path.
Reviewed by: kib, markj
Reported by: llm-postcr
MFC after: 3 days
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D61465
(cherry picked from commit 933f5f616a8a44b7af6cdccecf959ef1e8bab66e)
---
sys/vm/swap_pager.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 18eb251070d8..13407f79d282 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -2959,13 +2959,14 @@ swapgeom_close(struct thread *td, struct swdevt *sw)
sw->sw_id = NULL;
mtx_unlock(&sw_dev_mtx);
- /*
- * swapgeom_close() may be called from the biodone context,
- * where we cannot perform topology changes. Delegate the
- * work to the events thread.
- */
if (cp != NULL)
g_waitfor_event(swapgeom_close_ev, cp, M_WAITOK, NULL);
+
+ /*
+ * Release the reference added by kern_swapon when resolving the
+ * vnode.
+ */
+ vrele(sw->sw_vp);
}
static int