Re: Sysfs and suicidal attributes

Alan Stern
2007-07-11T15:04:34Z

On Wed, 11 Jul 2007, Tejun Heo wrote:

> Alright, there's our confusion. I thought you were gonna use dev->sem
> to protect new device addition && driver binding. We can use the same
> rwsem directly for binding protection too but I guess there's no big
> difference one way or the other.

The rwsem should not be used for binding protection. If we did trylock
then binding at the wrong time would fail, which would be bad. If we
did down_read then we would probably block while holding a device
semaphore, which also would be bad.

> Thanks for enlightening me. Probably what can be done is blocking
> regular file sysfs nodes automatically and make it optional (optionally
> enable or disable) for bin attrs.

Maybe. At the moment I don't see any reason to treat binary attributes
different from text.

It would also be good to find out whether there are any long-running
sysfs callbacks.

Alan Stern