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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user