From nobody Wed Sep 14 23:33:16 2022 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 4MSc8X5Bttz4cTtD; Wed, 14 Sep 2022 23:33:16 +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 4MSc8X4ZQvz3rQ5; Wed, 14 Sep 2022 23:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663198396; 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=2CEWhzuI3LrTulSFLmFBaSY2brPwYfYgg3SOteiOlsk=; b=DemK5tm8c9UQ8ft8oep5F+MMz7C99H5iECvZ121VKZ9Hl5hMY7zK+cYvlMfgvWM1wDAbPb g8vqa7qLkFoDzfa/1Iaf+vuNiAFHbMdMsERQNZkPVrTgCVhfJmvdpmh5u+jq28XS9pXrSO ULT7HxneHH5runaFHG7pWmNjW2qO9xNO38o22nEkpUqt6YhYg9g13jc4ltqXm5A4QZD0k4 WPvZWpbbMa9l5RVBToYzGBJuDQ8/50R9FRtX1u56qpmWTkmjhHJa3wQ5FJI8k8rHLptMKP zd1+yAz6eH845nW8uk8YMCLMm+whm8T0mfavQ/IOryY4ZHY0OEp3xWUmt7trhg== 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 4MSc8X3cZTzqBT; Wed, 14 Sep 2022 23:33:16 +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 28ENXGaW080958; Wed, 14 Sep 2022 23:33:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28ENXGn6080957; Wed, 14 Sep 2022 23:33:16 GMT (envelope-from git) Date: Wed, 14 Sep 2022 23:33:16 GMT Message-Id: <202209142333.28ENXGn6080957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: d04c7f10d43b - main - vfs: make delmntque return with the interlock held 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d04c7f10d43b121acac4c03d348d8aef193f89bc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663198396; 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=2CEWhzuI3LrTulSFLmFBaSY2brPwYfYgg3SOteiOlsk=; b=Cu4g45PES11mVguGh6fvrs/A7YrCdayDx/xB0PF4eWP1EtTRPGjmvc/ZxMG97BjPb8Y9v2 DcB/A4i1/GPetLFz7UouHGvxTXwRMcVu4c6eGjh7rwmWToKofRSHkhD94ET9IoEDX8ElQb 6iRJfCmpaLKghB7F7MfEVtP9OujHOGwA++XA+7HUlmXbq0cvlh2iQftiYp2dyT5HVovwZC 7LUlTi5nKTd5ep9P4Ht4P/MFSuEi1g2N924HTCdITywT2KkxtZgOarIsDBd00jDy+LqdWY JwIF9ysAtv0cvMJ+uNVZolB5Er934XBJ0Tq7WnDFQdTPVRMZg7EdEP+W0ZEv+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663198396; a=rsa-sha256; cv=none; b=MBbl/uBFkuqMEdgIRVxexNRzsiBX4Q0lGujkeeAV3EnuB4QtmnrnUAO74QlJHgDiwH0boc MXlJimPLx46bvAVwFO9CA0Fh0TRIKm1AvXpTuVmiaKnwf3xVbUNmtXTznaV+orpGbip7M5 dztsScrOgvqlBTwQr0gLX+a/grMe97yz5hcVNVcR3wEIqt4uVc/yazR2MV5+Myl4BNQyCm Q7qN7iexehX63ZaY7E0JIpboZMQstytDeE+FSDUuWW2V48ZE3GvipbTh+kwVcASCb6tbM3 1UOPFq90zWR2V+Zow6s7+7WDC3RhaqPHWeqAIiFJlIgnqBsgs5Nj+MqPYwXcZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d04c7f10d43b121acac4c03d348d8aef193f89bc commit d04c7f10d43b121acac4c03d348d8aef193f89bc Author: Mateusz Guzik AuthorDate: 2022-09-14 23:08:08 +0000 Commit: Mateusz Guzik CommitDate: 2022-09-14 23:30:19 +0000 vfs: make delmntque return with the interlock held saves on relocking dance -- the lock is taken immediately afterwards anyway. --- sys/kern/vfs_subr.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 739d22089f97..62430f4aaf39 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1944,18 +1944,19 @@ delmntque(struct vnode *vp) VNPASS((vp->v_mflag & VMP_LAZYLIST) == 0, vp); mp = vp->v_mount; - if (mp == NULL) - return; MNT_ILOCK(mp); VI_LOCK(vp); vp->v_mount = NULL; - VI_UNLOCK(vp); VNASSERT(mp->mnt_nvnodelistsize > 0, vp, ("bad mount point vnode list size")); TAILQ_REMOVE(&mp->mnt_nvnodelist, vp, v_nmntvnodes); mp->mnt_nvnodelistsize--; MNT_REL(mp); MNT_IUNLOCK(mp); + /* + * The caller expects the interlock to be still held. + */ + ASSERT_VI_LOCKED(vp, __func__); } static int @@ -4110,17 +4111,23 @@ vgonel(struct vnode *vp) /* * Clear the advisory locks and wake up waiting threads. */ - (void)VOP_ADVLOCKPURGE(vp); - vp->v_lockf = NULL; + if (vp->v_lockf != NULL) { + (void)VOP_ADVLOCKPURGE(vp); + vp->v_lockf = NULL; + } /* * Delete from old mount point vnode list. */ - delmntque(vp); + if (vp->v_mount == NULL) { + VI_LOCK(vp); + } else { + delmntque(vp); + ASSERT_VI_LOCKED(vp, "vgonel 2"); + } /* * Done with purge, reset to the standard lock and invalidate * the vnode. */ - VI_LOCK(vp); vp->v_vnlock = &vp->v_lock; vp->v_op = &dead_vnodeops; vp->v_type = VBAD;