Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_mcast.c
Show First 20 Lines • Show All 2,205 Lines • ▼ Show 20 Lines | if (in_pcbrele_wlocked(inp)) { | ||||
error = ENXIO; | error = ENXIO; | ||||
goto out_inp_unlocked; | goto out_inp_unlocked; | ||||
} | } | ||||
if (error) { | if (error) { | ||||
CTR1(KTR_IGMPV3, "%s: in_joingroup_locked failed", | CTR1(KTR_IGMPV3, "%s: in_joingroup_locked failed", | ||||
__func__); | __func__); | ||||
goto out_inp_locked; | goto out_inp_locked; | ||||
} | } | ||||
inm_acquire(imf->imf_inm); | /* | ||||
* NOTE: Refcount from in_joingroup_locked() | |||||
* is protecting membership. | |||||
*/ | |||||
ip_mfilter_insert(&imo->imo_head, imf); | |||||
} else { | } else { | ||||
CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); | CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); | ||||
IN_MULTI_LIST_LOCK(); | IN_MULTI_LIST_LOCK(); | ||||
error = inm_merge(inm, imf); | error = inm_merge(inm, imf); | ||||
if (error) { | if (error) { | ||||
CTR1(KTR_IGMPV3, "%s: failed to merge inm state", | CTR1(KTR_IGMPV3, "%s: failed to merge inm state", | ||||
__func__); | __func__); | ||||
IN_MULTI_LIST_UNLOCK(); | IN_MULTI_LIST_UNLOCK(); | ||||
imf_rollback(imf); | imf_rollback(imf); | ||||
imf_reap(imf); | imf_reap(imf); | ||||
goto out_inp_locked; | goto out_inp_locked; | ||||
} | } | ||||
CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); | CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); | ||||
error = igmp_change_state(inm); | error = igmp_change_state(inm); | ||||
IN_MULTI_LIST_UNLOCK(); | IN_MULTI_LIST_UNLOCK(); | ||||
if (error) { | if (error) { | ||||
CTR1(KTR_IGMPV3, "%s: failed igmp downcall", | CTR1(KTR_IGMPV3, "%s: failed igmp downcall", | ||||
__func__); | __func__); | ||||
imf_rollback(imf); | imf_rollback(imf); | ||||
imf_reap(imf); | imf_reap(imf); | ||||
goto out_inp_locked; | goto out_inp_locked; | ||||
} | } | ||||
} | } | ||||
if (is_new) | |||||
ip_mfilter_insert(&imo->imo_head, imf); | |||||
rgrimes: Why restest is_new? Cant this line just be moved up to the last line of the prior if (is_new)… | |||||
Done Inline ActionsThen we would need to change the error out logic too, I.E. remove the entry upon failure. I think it is best to not insert the entry before everything is clear. hselasky: Then we would need to change the error out logic too, I.E. remove the entry upon failure. I… | |||||
Done Inline ActionsI see your point. Let me re-order. hselasky: I see your point. Let me re-order. | |||||
imf_commit(imf); | imf_commit(imf); | ||||
imf = NULL; | imf = NULL; | ||||
out_inp_locked: | out_inp_locked: | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
out_inp_unlocked: | out_inp_unlocked: | ||||
IN_MULTI_UNLOCK(); | IN_MULTI_UNLOCK(); | ||||
▲ Show 20 Lines • Show All 815 Lines • Show Last 20 Lines |
Why restest is_new? Cant this line just be moved up to the last line of the prior if (is_new) right where the lock aquire was done before?