git: a6d04f34a4db - main - swap pager: lock vnode around VOP_CLOSE()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 25 Nov 2021 19:35:07 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6d04f34a4db6ff3fd5431ae10d4b877337fc138 commit a6d04f34a4db6ff3fd5431ae10d4b877337fc138 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-11-23 09:16:53 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-11-25 19:34:39 +0000 swap pager: lock vnode around VOP_CLOSE() Reported and tested by: peterj Reviewed by: markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33119 --- 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 9bc506c9b6b8..1a44d699bc05 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -3057,9 +3057,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