Is there a time limit on holding a lock ? We had to choose spin_lock_bh inside do_ioctl since it is run as user context and if hard_start_xmit was called the same time and tried to lock too we would be in a deadlock (actually ,this is how we found out about spin_*_bh :-). We have to use a single lock since we don't know in advance what topology changes could happen during do_ioctl so we need to halt all Tx/Rx until we know for sure we can forward a packet to one of the base drivers we're bound to etc. (I didn't want to bore everyone with code excerpts, but if you think it would help, then...). -----Original Message----- From: Jeff Garzik [mailto:jgarzik@mandrakesoft.com] Sent: Sunday, November 12, 2000 2:21 PM To: Hen, Shmulik Cc: 'Olaf Titz'; linux-kernel@vger.kernel.org; 'LNML' Subject: Re: catch 22 - porting net driver from 2.2 to 2.4 "Hen, Shmulik" wrote: > the thing is I need to prevent Tx/Rx when a topology change is initiated > from the ioctl (registering a virtual adapter is just one example), so they > all share a single lock and I must use spin_lock_bh from the ioctl. I do not think that they all need to shared a single lock. And we don't have your code, but spin_lock_bh may be an incorrect choice too. Note that when topology changes, that is an operation which might take more than a few milliseconds. Therefore, your solution should do something OTHER than spinning on a lock, while topology is changing. dev->open and dev->do_ioctl are called with rtnl_lock already held. You can sleep in them. Use that to your advantage... -- Jeff Garzik | Building 1024 | Would you like a Twinkie? MandrakeSoft | - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org