Page MenuHomeFreeBSD

bridgestp: Defer media queries outside the network epoch
Needs ReviewPublic

Authored by kbowling on Sun, Sep 20, 12:28 AM.
Tags
None
Referenced Files
F173189632: D59850.id.diff
Thu, Sep 24, 4:44 AM
F173182279: D59850.diff
Thu, Sep 24, 3:53 AM
Unknown Object (File)
Tue, Sep 22, 1:01 PM
Unknown Object (File)
Tue, Sep 22, 8:22 AM
Unknown Object (File)
Tue, Sep 22, 12:07 AM
Unknown Object (File)
Sun, Sep 20, 11:05 PM
Unknown Object (File)
Sun, Sep 20, 7:20 PM
Unknown Object (File)
Sun, Sep 20, 2:18 AM

Details

Summary
bridge_linkstate() calls bstp_linkstate() inside the network epoch, but
the SIOCGIFMEDIA ioctl can acquire sleepable driver locks and wait for
hardware. Reuse the port's media task on taskqueue_thread for link events
and existing media polling. Query in the interface's VNET without an
epoch or BSTP mutex, then recheck port activity and update STP under the
mutex and an epoch, since the state update can transmit BPDUs.

Run the subsequent STP state update for every media refresh, including
polling and reinitialization. This preserves query before update ordering
for link events and lets other refreshes process pending transitions
without waiting for the next STP tick. It does not add media queries or
increase the existing polling frequency.

Serialize link and packet input admission with port disable so late
callbacks cannot enqueue work after teardown drains it. Initialize STP
before publishing the bridge member. Drain media work before the
notifications it can generate, and keep the member's bridge pointer valid
until all of those callbacks finish. Wait for old epoch readers before
destroying the BSTP mutex, and protect the final root-port cleanup with
the mutex and an epoch.

PR:             264549
Reported by:    mfbott <bugaddress@posteo.net>
MFC after:      2 weeks

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped