Page MenuHomeFreeBSD

bridge: Release the bridge lock when calling bridge_set_ifcap()
ClosedPublic

Authored by kp on Jan 22 2017, 10:44 AM.
Referenced Files
Unknown Object (File)
Dec 13 2024, 11:24 PM
Unknown Object (File)
Dec 12 2024, 8:07 AM
Unknown Object (File)
Dec 2 2024, 3:05 AM
Unknown Object (File)
Dec 2 2024, 3:04 AM
Unknown Object (File)
Dec 2 2024, 3:04 AM
Unknown Object (File)
Dec 2 2024, 3:04 AM
Unknown Object (File)
Dec 2 2024, 3:04 AM
Unknown Object (File)
Dec 2 2024, 2:44 AM
Subscribers

Details

Summary
This calls ioctl() handlers for the different interfaces in the bridge.
These handlers expect to get called in an ioctl context where it's safe
for them to sleep. We may not sleep with the bridge lock held.

However, we still need to protect the interface list, to ensure it
doesn't get changed while we iterate over it.
Use BRIDGE_XLOCK(), which prevents bridge members from being removed.
Adding bridge members is safe, because it uses LIST_INSERT_HEAD().

This caused panics when adding xen interfaces to a bridge.

PR: 216304
Test Plan

Enable WITNESS

ifconfig bridge0 create
ifconfig bridge0 addm xn0
ifconfig bridge0 deletem xn0

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kp retitled this revision from to bridge: Release the bridge lock when calling bridge_set_ifcap().
kp updated this object.
kp edited the test plan for this revision. (Show Details)
kp added a reviewer: philip.
kp set the repository for this revision to rS FreeBSD src repository - subversion.
kp added a project: network.

Fix a really stupid typo.

ae added a reviewer: ae.

This looks correct to me. Also I think it would be nice to add BRIDGE_UNLOCK_ASSERT() and put it into bridge_set_ifcap(). Or at least add the comment why we do so.

This revision is now accepted and ready to land.Jan 24 2017, 1:01 PM
kp edited edge metadata.

Add the suggested BRIDGE_UNLOCK_ASSERT(), because that's a good idea.

This revision now requires review to proceed.Jan 24 2017, 2:46 PM
This revision was automatically updated to reflect the committed changes.