From nobody Thu Sep 28 09:06:58 2023 X-Original-To: dev-commits-src-branches@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 4Rx70312W0z4vm0h; Thu, 28 Sep 2023 09:06:59 +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 4Rx702736Qz4Wd3; Thu, 28 Sep 2023 09:06:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695892019; 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=8UVw8Y99F+QhpoynhBXamiqJas2nE+410HiYfOWXm40=; b=aWioR0goOIzF66zsSBOeX+AmGvmwoQHNZzdrIRhZ9L4+Cs4Bz9H4UGp2X3IIWBsKLTIxFH ar4IjtlhYmJ+5UGfIagJcTYi0k/w4nJqylAG3tT58akhZSPF2woZ5pEgOl9FHm+kdNUENx sffq/neXKQXBuvuOvwvEqooE4/1HLS4MFqG/iyY6URSX1ieQitXf7qtNK2ozHXZE0aF1xa vhS4NtLUgVIrX4e6vqyUe3Zfpv0yE0lOQM65Qd8/yYSojq7LoJ/5JDVKvjB9DsdB5tTIVY 2FaoIwF7W7x4YMHa/clgEV2WkGOouNK+P5eI2btU/MseO/zOzQ1JAdIB5jZ2pA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695892019; a=rsa-sha256; cv=none; b=kfnFkY6m2XLDuQYBx2KeOcO9lXoNRPX34nNPLYDwjWNkWBat3pVIdsvK+XKReGbLs1omLg EnvblvsLUgAQjO6ia3FOgXvJIALqjazOabVXTFHKkipPTTycwrgwjzK7aDw6+GkVREihv9 mkkOHV/DFhaIFgg2OWk9SoI9EAJaVwSUNLdobsNXAfA+XqwaRP9yXubD1FAv9nPwDovbZR FGpIEiOLHEJ6Dio9J0ltt/Itit8a71BORy80y9dBJmIO+QWYt9JNC9W0VyfUm9ZDqIq+GT tYtEuiY5MJ0rW8L93Bd3WttkFeD6Fc07PQ0hyhmFPuY0/ZZCNNg+7/Yk93jVUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695892019; 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=8UVw8Y99F+QhpoynhBXamiqJas2nE+410HiYfOWXm40=; b=Ha9mSOtQB4vOVkBnq0vFLSXVjhVkae3xOSRauxmgDLx9Cc52b/tQbZuHERLc1CpsxXV+2z xYtWZClZ/F/v+jq19hFlm5hN+J404uDSgdJ8Nf7GuKiAT3lX6V2kkzdmY5FxM9wEFgLYOt Q76V9tugKjWoBtSw4TZTLVZik8u2/YhzFlT065nlp+aTSB555LDADONvtY9YRfdwzH3CHT 1Mc1VZu2YSaVB+gSI7sdwdPdIyMS4CKrym/CE5SGWPAYqr9Vn5KQnyYZzuR42bAv0B8bis rsv1bUwpHRZeeD7LrKjIsvnO2ZFWknlNR0VLoiBKz4g61plNBn93dgDhwG+3mA== 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 4Rx70266mBz1pr; Thu, 28 Sep 2023 09:06:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38S96wnd040290; Thu, 28 Sep 2023 09:06:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38S96wJ1040287; Thu, 28 Sep 2023 09:06:58 GMT (envelope-from git) Date: Thu, 28 Sep 2023 09:06:58 GMT Message-Id: <202309280906.38S96wJ1040287@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: 40cec659c167 - stable/13 - vfs_remount_ro(): mnt_lockref should be only accessed after vfs_op_enter() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 40cec659c167d1773826cf44f5ef6394cb0ad8fd Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=40cec659c167d1773826cf44f5ef6394cb0ad8fd commit 40cec659c167d1773826cf44f5ef6394cb0ad8fd Author: Konstantin Belousov AuthorDate: 2023-09-20 03:42:31 +0000 Commit: Konstantin Belousov CommitDate: 2023-09-28 09:06:23 +0000 vfs_remount_ro(): mnt_lockref should be only accessed after vfs_op_enter() PR: 273953 (cherry picked from commit c584bb9cac16bc200ac45cc8b709e7e7e99e24bb) --- sys/kern/vfs_mount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index d81a42885a79..25c4adeaae62 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -2692,6 +2692,7 @@ vfs_remount_ro(struct mount *mp) struct vnode *vp_covered, *rootvp; int error; + vfs_op_enter(mp); KASSERT(mp->mnt_lockref > 0, ("vfs_remount_ro: mp %p is not busied", mp)); KASSERT((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0, @@ -2700,17 +2701,19 @@ vfs_remount_ro(struct mount *mp) rootvp = NULL; vp_covered = mp->mnt_vnodecovered; error = vget(vp_covered, LK_EXCLUSIVE | LK_NOWAIT); - if (error != 0) + if (error != 0) { + vfs_op_exit(mp); return (error); + } VI_LOCK(vp_covered); if ((vp_covered->v_iflag & VI_MOUNT) != 0) { VI_UNLOCK(vp_covered); vput(vp_covered); + vfs_op_exit(mp); return (EBUSY); } vp_covered->v_iflag |= VI_MOUNT; VI_UNLOCK(vp_covered); - vfs_op_enter(mp); vn_seqc_write_begin(vp_covered); MNT_ILOCK(mp);