]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
A few locking fixes and cleanups to pfil hook registration,
authorrwatson <rwatson@FreeBSD.org>
Tue, 16 Dec 2008 17:03:22 +0000 (17:03 +0000)
committerrwatson <rwatson@FreeBSD.org>
Tue, 16 Dec 2008 17:03:22 +0000 (17:03 +0000)
commit1d38ccff9412b97456b3869f294eda87234057c9
treeaa6c7a5689d761c4ddf4a01aeb74dc38124a4482
parenta06a1075a6719e0d49495a44becc791ba9f37bbc
A few locking fixes and cleanups to pfil hook registration,
unregistration, and execution:

- Add some brackets for clarity and trim a bit of vertical whitespace.
- Remove comments that may not contribute to clarity, such as "Lock"
  before acquiring a lock and "Get memory" before allocating memory.
- During hook registration, don't drop pfil_list_lock between checking
  for a duplicate and registering the hook, as this leaves a race
  condition by failing to enforce the "no duplicate hooks" invariant.
- Don't lock the hook during registration, since it's not yet in use.
- Document assumption that hooks will be quiesced before being
  unregistered.
- Don't write-lock hooks during removal because they are assumed
  quiesced.
- Rename "done" label to "locked_error" to be clear that it's an error
  path on the way out of hook execution.

MFC after: pretty soon
sys/net/pfil.c