From nobody Thu Sep 28 09:06:02 2023 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 4Rx6yy4Fsmz4vlZN; Thu, 28 Sep 2023 09:06:02 +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 4Rx6yy3lXQz4VF0; Thu, 28 Sep 2023 09:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695891962; 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=T7vO9JMD2bblddoujaA7AvNRa7ycoGGtW0WjX6dSepg=; b=QVBTAfmQitjquHbeGUQYc5HLTKCuHsPkaaftpqV2Z1DBSj0ZdIAKQi0z8kc9ody6im5MKo V8g+bIfI+KJtzjOz/iUJSeMbzw0HVvMEcq4AbTQuR3+2ADktqKUTPLTUkjhQGQklgsRRct jkWuW2Cd6+JCCVUmuY/w8YYpnf5uAxxxoDiGW/ZzDclO//ERBw/azYhgBli2L1xPpH8Z7P apHMfzSl5Q7lsMMIXXWIsfMKdDg9w4x4RVBODOB9wX+xNN91KyolQtcZqggnuljNs2ZwKu +oZmkx6HK/cBl6zdfNOeqQseo4VSyGkheYnWxiB4DrJnucp4FKcnKNCmXAwTMA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695891962; a=rsa-sha256; cv=none; b=EOFJ7c9SNk7+A6IH34a+3xJCgJEXBa6E+kEBhwpEf4WGt35TfRBKHPSBW0TnFppbzHfr+F nfdDwO+vt9AUEBI4ULUEDXHeoh/JhoCWXuWl7On8erW1o+57T/Zap2PpFMDlO1fPjtX2gn X2R7eVQtr2Wi8u4xeLIybfHa7kZ/k60ZJf20ZYDTSAqhGjCLvVXf7hhbdXx8aLpQC1sRo6 tJWELOAm1V4vssKTeEExEHcbPLhlgMVjv0+s2FdeR4umOn2hpG9eW7wC+r0hJe3nibBIdO fnQwB0KJPkfdZLpzrSs9n8o2eHabDMOpRUnUYbLkG05deM+S7t10asWKjonpnA== 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=1695891962; 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=T7vO9JMD2bblddoujaA7AvNRa7ycoGGtW0WjX6dSepg=; b=NpIGBa9+qX2pdGfJcXZXZEXycuEPAX7tslczU3TohqkpqEyvw4+rJsO9RgFp6/QzOdv+aO lIPatT6JqXkRZQ0TVusWJbmYqJ6nFwZetrNVI0gOm9XJrpvoGUXK+lGsKKHTKAmXScEMzi R8HUlS4rpyT9OLgsB/+AFWsiRdCpAk0mSu36YvsIgFrr0RelvgE6N8wZfYcUdLz+1JDtCN M/gXaX/x8erp+OsXhbsBkrpIYHlru+ofubeRAWsCxhyyIJvGOax+M+iT68Sfn+mx+JGQ2I w89OpwjHiFxKmSJvnQPHq4McoRi4JqPTGnUPimwacsG32PHD66uZ0j8PRA8kcA== 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 4Rx6yy2hxQz1d7; Thu, 28 Sep 2023 09:06:02 +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 38S962FI040035; Thu, 28 Sep 2023 09:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38S962r6040032; Thu, 28 Sep 2023 09:06:02 GMT (envelope-from git) Date: Thu, 28 Sep 2023 09:06:02 GMT Message-Id: <202309280906.38S962r6040032@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: 5b200ff58126 - stable/14 - vfs_remount_ro(): mnt_lockref should be only accessed after vfs_op_enter() 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/14 X-Git-Reftype: branch X-Git-Commit: 5b200ff58126a028ba357f297cbb596a7475962c Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5b200ff58126a028ba357f297cbb596a7475962c commit 5b200ff58126a028ba357f297cbb596a7475962c Author: Konstantin Belousov AuthorDate: 2023-09-20 03:42:31 +0000 Commit: Konstantin Belousov CommitDate: 2023-09-28 09:05:05 +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 45ab9cfc93cc..8364081585f8 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -3004,6 +3004,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, @@ -3012,17 +3013,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);