Serialize netdump configuration / deconfiguration, and discard our
configuration when the affiliated interface goes away.
Details
- Reviewers
markj vangyzen - Commits
- rS347473: netdump: Ref the interface we're attached to
$ dumpon ... vtnet0 $ dumpon -lv ... vtnet0 ... $ devctl detach vtnet0 $ ifconfig ... (no vtnet0) $ dumpon -lv ... (no vtnet0)
No witness warnings I could see with that workflow on GENERIC.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sys/netinet/netdump/netdump_client.c | ||
---|---|---|
1432 ↗ | (On Diff #57203) | Since you're modifying this function, go ahead and fix this copy-pasto. |
1436 ↗ | (On Diff #57203) | ...and this one. |
1460 ↗ | (On Diff #57203) | Shouldn't you if_rele(nd_ifp); nd_ifp = NULL; here, too? (if it's not NULL) In fact, there is enough duplication between this block and netdump_ifdetach() that you could refactor into a new netdump_unconfigure(). |
sys/netinet/netdump/netdump_client.c | ||
---|---|---|
1432 ↗ | (On Diff #57203) | I'll do that separately — it's logically distinct from this change. |
1460 ↗ | (On Diff #57203) | Yes, good catch on both counts, thanks! I thought nd_enabled <==> (nd_ifp != NULL), but it doesn't really appear to be the case. I think it probably should be; the only added complexity is the net.netdump.enabled sysctl becomes a proc instead. This also suggests that various places that set nd_enabled = 0 should also release the interface ref — probably using your proposed netdump_unconfigure(); |
sys/netinet/netdump/netdump_client.c | ||
---|---|---|
1273 ↗ | (On Diff #57289) | Perhaps consider using a bool netdump_enabled(void) predicate which asserts that the conf lock is held. |
sys/netinet/netdump/netdump_client.c | ||
---|---|---|
1273 ↗ | (On Diff #57289) | Ok |
- Add and use netdump_enabled() predicate. We rely on sx_assert neutering
during kdb/panic to obviate the lock assertion during the dump-time code, which
generally does not take locks.