From: Keith W. <ke...@tu...> - 2003-02-23 20:00:04
|
Linus Torvalds wrote: > On Sat, 22 Feb 2003, Keith Whitwell wrote: > >>What about processes that *don't* do a close - that just use an fd and exit. > > > The exit does a close, and you'll see a flush() from the dying process > (and a release() if that was the last user). > > >>In the threaded demo I'm looking at, there is only one close -- in the same >>thread that did the open. The other threads just die. > > > If a thread does a close(), then that will have closed it in the other > threads too. You will not get any notification from the other threads, > since they will never have anything to notify about - the file is already > dead as far as they are concerned. > > >>But sadly for me, the thread that does the open isn't the one that sees the >>flush() or release() events: > > > Whoever does the close() generates the flush(). > > And the release() can be generated by anybody, although in practice it's > going to be the same one that did the final flush() in 99.99% of all cases > (but if you depend on it, you're just asking for trouble). > > >>The last line indicates that 1063 held the lock. I never see a flush() for >>that pid. > > > The answer really is that you shouldn't care about the pid at all. OK, here's a patch, first attempt at doing this. It's not ready to commit yet, unless we start a branch for this... Things actually work pretty well, and a couple of lockups seem to have disappeared as a result. There are at least two issues: 1) Hard lockup when the X server recycles. 2) This breaks other OS's -- they'll need to play catchup, I think. otherwise, I'm interested in feedback. Keith |