[OpenAFS-devel] CheckHost patch version 2
Jeffrey Hutzelman
jhutz@cmu.edu
Mon, 21 Nov 2005 17:48:29 -0500
On Monday, November 21, 2005 04:27:40 PM -0500 Jim Rees <rees@umich.edu>
wrote:
> well, you can but you need to call h_Lock(host) and not h_Lock_r().
>
> Yes, but no one does.
>
> I think my next step is to rationalize the locks so that H_LOCK is only
> (and always) used to protect the hash table, and h_Lock is only used to
> protect the host entry. I think the order should be the other way
> around, too.
I think those are fine things to do, but in the unstable branch, not the
1.4.x branch, and only after a careful analysis of how these locks are
being used and why. The current code mostly works, and making sweeping
changes to things that mostly work is not appropriate for 1.4.x.
At the moment, I'm not convinced that anything is fixed by not holding the
host lock across the RPC, as long as the H_LOCK is not held. If there
turns out to be such a problem, then correct fix may involve certain
lockers using h_NBLock_r, rather than preventing the lock from being held
across the RPC.
Note that when this code was written, there was no pthreads support in AFS;
there was only LWP, in which you could assume no other thread was running
as long as you didn't yield. The entire _point_ of the host locks was to
lock out other processes while waiting for an RPC to complete.
-- Jeff