[OpenAFS-devel] Re: [OpenAFS] OopenAFS 1.2.13: ever increasing number of fileserver connections - h_Hold leak

Rainer Toebbicke rtb@pclella.cern.ch
Thu, 10 Feb 2005 15:18:18 +0100


Jim Rees wrote:
>   I'd keep the asignment of zero (static int lih_host_held = 0;) because
>   it does not hurt for good compilers and works around a bug in compilers
>   that do not follow the standard.
> 
> I might use an ifdef, because this is clearly a bug workaround, and it can
> have a cost for other compilers.  The item could end up in the data section
> rather than bss.

I disagree with both of you:

the point is that no initialisation is required! lih_host_held is set 
whenever lih_host is set to something else than 0, and only used 
afterwards if lih_host is not 0. lih_host in turn is set to '0' "by 
hand" prior to starting the h_Enumerate.

I took the initialisation away because its presence confused me. A 
comment /* No need to initialise this */ would have made it more 
obvious. Alternatively, you can always waste a few cycles and add 
lih_host_held=0; just after lih_host=0;

But not a static initialisation - this is meaningless in code which is 
run again and again but is meant to have no history after the lock is 
given up.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155