git: 81c9a051ea35 - stable/13 - swap pager: lock vnode around VOP_CLOSE()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Dec 2021 02:31:51 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=81c9a051ea35ff784437ba780399447154d56cfa commit 81c9a051ea35ff784437ba780399447154d56cfa Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-11-23 09:16:53 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-12-02 02:21:14 +0000 swap pager: lock vnode around VOP_CLOSE() (cherry picked from commit a6d04f34a4db6ff3fd5431ae10d4b877337fc138) --- sys/vm/swap_pager.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 6d64ff883966..38c225db51ee 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -3050,9 +3050,12 @@ swapdev_strategy(struct buf *bp, struct swdevt *sp) static void swapdev_close(struct thread *td, struct swdevt *sp) { + struct vnode *vp; - VOP_CLOSE(sp->sw_vp, FREAD | FWRITE, td->td_ucred, td); - vrele(sp->sw_vp); + vp = sp->sw_vp; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + VOP_CLOSE(vp, FREAD | FWRITE, td->td_ucred, td); + vput(vp); } static int