On (09/20/07 14:13), Artem Kachitchkine wrote:
>
> Right. If we hold i_mac_prop_lock as RW_READER while finding and using
> proplist, attempts to free will wait because they want RW_WRITER; yet
> multiple updates can run in parallel. I'm pretty sure that'll work, since
> I've just raised my blood sugar by eating a huge cookie :)
There's also some logic in mac_open() itself that can be leveraged
for the particular case I flagged (detach and update as a result
of 'dladm set-linkprop...' colliding):
/*
* Hold the given instance to prevent it from being detached.
* This will also attach the instance if it is not currently attached.
* Currently we ensure that mac_register() (called by the driver's
* attach entry point) and all code paths under it cannot possibly
* call mac_open() because this would lead to a recursive attach
* panic.
*/
if ((dip = ddi_hold_devi_by_instance(major, ddi_instance, 0)) == NULL)
return (EINVAL);
but I'm not sure if this covers all possible cases. Would need to verify
by examination of the code..
--Sowmini