OpenAFS CVS Commit: openafs/src/viced by shadow

cvs@GRAND.CENTRAL.ORG cvs@GRAND.CENTRAL.ORG
Tue, 01 Apr 2003 19:23:58 EST


Update of /cvs/openafs/src/viced
In directory GRAND.CENTRAL.ORG:/data/sb/openafs-stable-1.2/openafs/src/viced

Modified Files:
      Tag: openafs-stable-1_2_x
	host.c 
Log Message:
DELTA STABLE12-h-gethost-r-race-20030401
AUTHOR shadow@dementia.org
FIXES 1308

Thanks to Chaskiel Grundman for explaining what was happening:
- the connection is old and pre-existing, but has no host structure.
- 2 calls come in
- the first one enters h_GetHost_r, and h_Lookup_r returns null (but identP is
non-null, since rx keeps it around until it gc's the connection)
  The first thread calls WhoAreYou, which succeeds, it then calls
InitCallBackState3 (after H_UNLOCK) note that the host has been inserted into
the hashtable
- the second thread enters h_GetHost_r, and calls rx_GetSpecific. it then
calls h_Lookup_r. h_Lookup_r will block (new host is locked), but eventually
returns the new host
- InitCallBackState3 returns, and the frees the old identP, replaces it, and
unlocks the host.
- the first thread returns from h_Lookup_r. boom.

the changes:
-call rx_GetSpecific after h_Lookup_r returns (and potentially slept)
-removes an if wrapping which always is true (since !interfValid is always
 true)
-don't realloc identP if it exists
-don't free an old one by calling rx_SetSpecific either


--- DELTA config for openafs-stable-1_2_x follows ---
STABLE12-h-gethost-r-race-20030401 openafs/src/viced/host.c 1.7.2.15 1.7.2.16