From nobody Thu Nov 25 19:35:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5BE9518A4C55; Thu, 25 Nov 2021 19:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J0Sl00ZnQz3C2B; Thu, 25 Nov 2021 19:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8A8F23480; Thu, 25 Nov 2021 19:35:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1APJZ78Z094678; Thu, 25 Nov 2021 19:35:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1APJZ73e094677; Thu, 25 Nov 2021 19:35:07 GMT (envelope-from git) Date: Thu, 25 Nov 2021 19:35:07 GMT Message-Id: <202111251935.1APJZ73e094677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a6d04f34a4db - main - swap pager: lock vnode around VOP_CLOSE() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6d04f34a4db6ff3fd5431ae10d4b877337fc138 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637868908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hMrXfy2Ux95Kmsos0qnBGyWk+zHFZAI3Z3xKcSm7nKQ=; b=dA8ixE0UIX7w5hPkQXaqJnKLT6Jr51hRv6ip4W71odYitfGkC6EHBXWYw0idPUFSfZVgkA JNX8bsQ2svkyuMFPPlPRd7sGNeEubRGt9L3JtDfR+zQdmW/yTykDo4bbMmoUHxmaCjWxzr culUhjxazN287rpCeubMs23vEoJVnzN6uixT/X20e3+VJX5VOlXuqOw6RTTfPbyeFcRlF4 xvp70luXlJ1GCYuxF8O/E4MF8lxnmt/V1kiIwOq1QbNwW2hOMgUSp34X4F6cWTQ8XFeQ9M fCLnp+gF6YQVvqNPYo3nDYE4UoFZNRNiwp8VxiT8gWFdigzGCNCP7uD4JUwNWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637868908; a=rsa-sha256; cv=none; b=pZWmIY5vO5nsbE4bpM2dVbjmnDn1mlaPSRrvvbAqzpp0i6jcOE35Cbweoq1Z7sAvZHapbH o9hXwHGEYNnjZzUZL99kYiZHjYid7RA8lG7mYXqEBIhbmYdUU8BCMtN7/zD0XuwNvz8AzF JD12KZmomutI/tZxcJGa5wJosyOYOMVpDU8fOQXGLgNLgxCU7fjTLG7Pq6z0tp0dm+lX4u N60EgxNn/lHKAwgq9y+bkzc0XFOol6Hu0G/nFpa2ckkk66pUApkZL5xd/q6ZtvRGXcF2EY vOKRk0tK01HfidSHkAy9iIGgk6MJ9sI8K1QHQ06EcHQRjPnhSsRnslozGiz0EQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6d04f34a4db6ff3fd5431ae10d4b877337fc138 commit a6d04f34a4db6ff3fd5431ae10d4b877337fc138 Author: Konstantin Belousov AuthorDate: 2021-11-23 09:16:53 +0000 Commit: Konstantin Belousov 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