git: cbac897a7b05 - main - in6_mcast: Acquire ref to ifp and exit epoch earlier in sysctl
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Mar 2026 13:38:26 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=cbac897a7b057427cfaab12cc143144eadd1e80d
commit cbac897a7b057427cfaab12cc143144eadd1e80d
Author: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-03-23 18:38:46 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-03-24 13:37:23 +0000
in6_mcast: Acquire ref to ifp and exit epoch earlier in sysctl
This patch reduces the number of witness warnings during ifmcstat(8) calls.
Reviewed by: glebius, zlei
Differential Revision: https://reviews.freebsd.org/D56052
---
sys/netinet6/in6_mcast.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 4e770079e64e..7942faefd568 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -2806,9 +2806,9 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS)
ifindex = name[0];
NET_EPOCH_ENTER(et);
- ifp = ifnet_byindex(ifindex);
+ ifp = ifnet_byindex_ref(ifindex);
+ NET_EPOCH_EXIT(et);
if (ifp == NULL) {
- NET_EPOCH_EXIT(et);
CTR2(KTR_MLD, "%s: no ifp for ifindex %u",
__func__, ifindex);
return (ENOENT);
@@ -2821,7 +2821,7 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS)
retval = sysctl_wire_old_buffer(req,
sizeof(uint32_t) + (in6_mcast_maxgrpsrc * sizeof(struct in6_addr)));
if (retval) {
- NET_EPOCH_EXIT(et);
+ if_rele(ifp);
return (retval);
}
@@ -2856,7 +2856,7 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS)
}
IN6_MULTI_LIST_UNLOCK();
IN6_MULTI_UNLOCK();
- NET_EPOCH_EXIT(et);
+ if_rele(ifp);
return (retval);
}