Matthew Wilcox wrote: > On Mon, May 03, 2004 at 01:29:48PM +0100, Matthew Wilcox wrote: > >>How about the following patch? Noet that vfree() handles a NULL argument, >>so it's not necessary to check the pointer. > > > That patch is crap -- it only frees the memory on the error path, not > the normal exit. Since I got confused by this function, it struck me > as not unreasonable that somebody else might also get confused by it > and split it into two parts. > > I simplified some of the code. The old code took the lock, scanned > through looking for a free slot, dropped the lock, allocated an sdp, > grabbed the lock and checked the slot was still free, branching back > if it had raced. This rewrite assumes that we will find a slot and > allocates an sdp in advance. > > Does anybody like this patch? It survived booting on my test box which > only has one scsi device. More testing welcomed. Sorry, I missed this thread. The change looks good and survived about one hour of scsi_debug bashing (on i386). I also checked it against the previous version. Attached is my version with only a superficial change to 2 printk()s plus: - bump version number - introduce MODULE_VERSION - increase over allocation of sg_dev_arr from 6 to 32 Doug Gilbert