diff options
| author | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-03-23 18:38:46 +0000 |
|---|---|---|
| committer | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-03-24 13:37:23 +0000 |
| commit | cbac897a7b057427cfaab12cc143144eadd1e80d (patch) | |
| tree | a5a4875a47fdd2376b83071179aa8317af34bcd3 | |
| parent | e6a77f81d1eb345f6a8c827ecf555b88996c8763 (diff) | |
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
| -rw-r--r-- | sys/netinet6/in6_mcast.c | 8 |
1 files 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); } |
