HomeFreeBSD

Implement new callout_init_lock_function() callout API function to

Description

Implement new callout_init_lock_function() callout API function to
support locking constructions.

The purpose of this function is to allow a function callback to do
locking before the callback is called, in order to solve race
conditions. The function callback, callout_lock_func_t, is passed two
arguments. The first is the callout's callback argument, and the
second is an integer, if set, indicates a lock operation, and if
cleared, indicates an unlock operation.

Some clients of the callout API like the TCP stack use locking
constructions, that means one more more locks locked in series. By
using callout_init_lock_function() these clients can lock all the
locks required in order to atomically to complete their operations,
instead of using lock-unlock-lock sequences which open up for races.

Details

Provenance
hselaskyAuthored on
Parents
rS302767: MFC r286710: 6093 zfsctl_shares_lookup should only VN_RELE() on
Branches
Unknown
Tags
Unknown