From nobody Fri Feb 04 09:25:26 2022 X-Original-To: dev-commits-src-main@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 A8C8519B02B9; Fri, 4 Feb 2022 09:25:26 +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 4Jqqrk4PH7z4Whj; Fri, 4 Feb 2022 09:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643966726; 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=LyY9xICTkHAbsZla/McU1cr3r92wsB3s21rHrhW/byE=; b=ZTf4U81JlzzgweI4tXULtJtUPgCH+hlgBCL8YH3I6trjAhxwK06Nw+5fYllI5rquLANiSc npQh8FdWjdBs0ih3oSWWNJi59qViieTm+dKm4KwYcFPKikCePfkbPnxXqNeOQcF+aZRpTj ApqiH3XPgDySzAWAOLQUoyM8Lh0zVwY4xpM2KP0yGCnpyVBjAWexivmNdcyC1qT8FG0DU3 GRWRom4pv6qLD9Qozyho+9F/t513FjkgLnt+Mq4m7powfr4KjnBgEgsMEUpXOKLomrS7nf xcIKAspRKxLEfF5rq/V3OcN1g6Cfqkhep3b5HP/9Zzkb5e/q17yCYwO+ZHKk9Q== 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 769DF119C; Fri, 4 Feb 2022 09:25:26 +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 2149PQc1050916; Fri, 4 Feb 2022 09:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2149PQFv050915; Fri, 4 Feb 2022 09:25:26 GMT (envelope-from git) Date: Fri, 4 Feb 2022 09:25:26 GMT Message-Id: <202202040925.2149PQFv050915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: cd7306bb1fd1 - main - ip_mroute: split mrouter interface deactivation and if_free List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd7306bb1fd1c4f2b2875bb7947ef5ee905f5f26 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643966726; 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=LyY9xICTkHAbsZla/McU1cr3r92wsB3s21rHrhW/byE=; b=N1iqsPb1G64C5SqFILUGlRPmi3hbDNPu4UM3amRg6br+Od5wIsMimF0A0aHAxtoPB66m3G b4dKDXoMg37jgc0FAHsHS5VgegsRhYsUa1ypkT6WvAhf6PHi4bJ1EIksIBcPp4ybMZr2Ow pP1gzMxmOkerVU5XUsY4mmELgY39mWBdec0I8UI2WIxDlQKqZ32CNK74o2sVcBcDdre90T oFgrD/HT11Kj/2C7GfoRWaUxWBFzsp/EkGZhx/+HDdmE7Rp4MQO1M9gHefgM6gV4WN6VE9 M8YY81K6Bt3H8GkVnaoiB8bhwinFBIdEN/aDJYYvrcMrF4rM+A5BXngbjuqLhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643966726; a=rsa-sha256; cv=none; b=tF5dPAa6lX4dHuCyXQ8aLXQDSO96Q+ZUfUgj25uOpW4f6HDXB2PT6CwvjaPvohzeIbcVxm pAYRukFPmNOqkbe7NfBInDq7UBphfGC7Ruw4e4Z5sCUHYrqNEaqUJWCpeFEnrYEmbX1a7n 2LTrGKC+L2S77bfIbHz+3SOQTzQE/lug+TL3YkgQVq2++vNEYoalY7EtdKxLlNdPZnDuRy c8WYh2QHuY3pZAS9OeEpTOdAEBTsqciRkYdJDPEKG2ld4yVhJX/QwYImnZ4uTcFBmlAmqp OECbRTxOQtVZK8ev2IYej7KxZEiZjfrsl5X2INDVAtzrBQJuokFn8968aiNWOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=cd7306bb1fd1c4f2b2875bb7947ef5ee905f5f26 commit cd7306bb1fd1c4f2b2875bb7947ef5ee905f5f26 Author: Sylvian Meygret AuthorDate: 2022-02-04 09:19:55 +0000 Commit: Wojciech Macek CommitDate: 2022-02-04 09:25:07 +0000 ip_mroute: split mrouter interface deactivation and if_free Move if_free outside MRW_LOCK. This will silence LOR message which might appere during deinitialization. --- sys/netinet/ip_mroute.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index c678acd650c0..99ec2952de88 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -316,7 +316,7 @@ static void bw_upcalls_send(void); static int del_bw_upcall(struct bw_upcall *); static int del_mfc(struct mfcctl2 *); static int del_vif(vifi_t); -static int del_vif_locked(vifi_t); +static int del_vif_locked(vifi_t, struct ifnet **); static void expire_bw_upcalls_send(void *); static void expire_mfc(struct mfc *); static void expire_upcalls(void *); @@ -621,7 +621,8 @@ static void if_detached_event(void *arg __unused, struct ifnet *ifp) { vifi_t vifi; - u_long i; + u_long i, vifi_cnt = 0; + struct ifnet *free_ptr; MRW_WLOCK(); @@ -650,10 +651,20 @@ if_detached_event(void *arg __unused, struct ifnet *ifp) } } } - del_vif_locked(vifi); + del_vif_locked(vifi, &free_ptr); + if (free_ptr != NULL) + vifi_cnt++; } MRW_WUNLOCK(); + + /* + * Free IFP. We don't have to use free_ptr here as it is the same + * that ifp. Perform free as many times as required in case + * refcount is greater than 1. + */ + for (i = 0; i < vifi_cnt; i++) + if_free(ifp); } static void @@ -982,10 +993,12 @@ add_vif(struct vifctl *vifcp) * Delete a vif from the vif table */ static int -del_vif_locked(vifi_t vifi) +del_vif_locked(vifi_t vifi, struct ifnet **ifp_free) { struct vif *vifp; + *ifp_free = NULL; + MRW_WLOCK_ASSERT(); if (vifi >= V_numvifs) { @@ -1004,7 +1017,7 @@ del_vif_locked(vifi_t vifi) if (vifp->v_ifp) { if (vifp->v_ifp == V_multicast_register_if) V_multicast_register_if = NULL; - if_free(vifp->v_ifp); + *ifp_free = vifp->v_ifp; } } @@ -1027,11 +1040,15 @@ static int del_vif(vifi_t vifi) { int cc; + struct ifnet *free_ptr; MRW_WLOCK(); - cc = del_vif_locked(vifi); + cc = del_vif_locked(vifi, &free_ptr); MRW_WUNLOCK(); + if (free_ptr) + if_free(free_ptr); + return cc; }