Hi Alan, > But usbfs may suffer from complications as a result of its unorthodox > approach to device ownership.
Yes, you have put your finger on it. > > Currently ps->dev is set to NULL in > > the devio.c usbfs disconnect method (if some interface is claimed) or in > > inode.c on device disconnect, making it hard to lock with > > ps->dev->serialize :) Thus disconnect should no longer be signalled by > > setting ps->dev to NULL. > > If you would keep the ps->devsem lock, would there be any problem in > setting ps->dev to NULL to indicate disconnection? You can't keep the ps->devsem lock and use ps->dev->serialize, because it leads to deadlock. Actually, simply replacing ps->devsem with ps->dev->serialize cannot lead to any new deadlocks, it makes deadlocks that could occasionally happen always happen (such deadlocks exist right now in usbfs). Some of the current deadlocks can be eliminated without giving up ps->devsem, but not all. So the question is: must ps->dev->serialize be used? > Are they any reasons for not keeping ps->devsem? Since usbfs generally > acts as a driver and drivers generally don't have to concern themselves > with usbdev->serialize (the core handles it for them), shouldn't usbfs > also be able to ignore ps->dev->serialize? No, because it needs to do operations on interfaces it hasn't claimed (such as looking them up and claiming them). This is why it needs to protect itself, at least momentarily, against configurations shifting under it. This can be done by using the BKL more. However it can be done more simply using ps->dev->serialize (in fact it is simpler than what is there now). By the way, if it is somehow fatal to do usb_put_dev after disconnect, what is the point of referencing counting at all? You might as well free up the usb_device structure immediately after disconnect, since there is sure to be a reference before disconnect, and (apparently) there had better not be a reference after disconnect... All the best, Duncan. ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel