From nobody Thu Dec 02 02:31:53 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 A8CD318AC0AB; Thu, 2 Dec 2021 02:31:54 +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 4J4Kj573ygz4nmB; Thu, 2 Dec 2021 02:31:53 +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 7FF281583C; Thu, 2 Dec 2021 02:31:53 +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 1B22VrRp073922; Thu, 2 Dec 2021 02:31:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B22Vrg6073921; Thu, 2 Dec 2021 02:31:53 GMT (envelope-from git) Date: Thu, 2 Dec 2021 02:31:53 GMT Message-Id: <202112020231.1B22Vrg6073921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3a98b98be504 - stable/13 - swap_pager: lock vnode in swapdev_strategy() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a98b98be504e5ba3faf0fdf58271681d9eee5a1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638412314; 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=oH1G2R06zyJBPN3Ed9WlOTgkOMdxUW/Y23zCgnF1lIQ=; b=pbCsn8MLo1BEpjbkW9/wRgEQaQN9Shkminldgz++ousm3k5LOuCAfh4esLfJj41o+Ay/XN 009OKiQj4I9K78PJi8rbc6Izr2Ul3+CwpGa5ELafPwoBX8QLBQsLv0Q675JYwYTYYsWWO3 0GoVHcvKNUjMMSbHKJiiZ0Ov+Rb4I6bjtFjpIpXiVgvngcgmhW9NeZ6x4rBcb3dV5ZbLbx 2UQusDDg6ooxZK3Jl9/VRqNtD7mNYWQnZ8j+F023UN9FXQjaLnjB4IAHNqf5W/RtZTq7wl qoAXBrdnMLnOFF6J/K4TARnrdI/IzIO8LQHe4hPCzL4cR+kpgbungOjcXxzeSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638412314; a=rsa-sha256; cv=none; b=dttZga4u2PcndL89yTnF+cpDCSxcsYgwDSU7ZbFnNOBjJSzmqRpivRS779OTmgDW3Qd3BS Ap4xGGwoGsrfjZpxG4LVvdCtUnjHdt4YS6HaB4DenfkzBGpEnT6Y7R7TnEuznnmaakLuBh VrvKLjeIg7FNY3PFxdRKItbJ2W1TnwsIgluRkO8pVFoF051jn5AXeS0CJjkdSmK7vpSzfM W7Cwh66mXBp9d//se1LEPmJ9J7fCSyOC3sLgHcpKwxwFzSrEvsmlL2tTMULvnznmcgdSCd lST7IqqqFShQXja+AhiwrmeYoPcZ4qQ86RpS6YBXxCRNTrz6+JxPC09Om7Z+rA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a98b98be504e5ba3faf0fdf58271681d9eee5a1 commit 3a98b98be504e5ba3faf0fdf58271681d9eee5a1 Author: Konstantin Belousov AuthorDate: 2021-11-24 11:26:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-12-02 02:21:15 +0000 swap_pager: lock vnode in swapdev_strategy() (cherry picked from commit b19740f4ce7a542783f87de2fee48476a7801d86) --- sys/vm/swap_pager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 8363dce52683..78533c9fb5e6 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -3036,16 +3036,19 @@ swapdev_strategy(struct buf *bp, struct swdevt *sp) vp2 = sp->sw_id; vhold(vp2); if (bp->b_iocmd == BIO_WRITE) { + vn_lock(vp2, LK_EXCLUSIVE | LK_RETRY); if (bp->b_bufobj) bufobj_wdrop(bp->b_bufobj); bufobj_wref(&vp2->v_bufobj); + } else { + vn_lock(vp2, LK_SHARED | LK_RETRY); } if (bp->b_bufobj != &vp2->v_bufobj) bp->b_bufobj = &vp2->v_bufobj; bp->b_vp = vp2; bp->b_iooffset = dbtob(bp->b_blkno); bstrategy(bp); - return; + VOP_UNLOCK(vp2); } static void