[OpenAFS] Strange access problems on one client
Marc Dionne
marc.dionne@technoconseil.com
Sun, 07 Oct 2007 13:15:00 -0400
This is a multi-part message in MIME format.
--Boundary_(ID_V5syCXgy8SDDgedaatULpw)
Content-type: text/plain; charset=UTF-8; format=flowed
Content-transfer-encoding: 7BIT
Norbert Schuch wrote:
> Hi,
>
>
> Dirk Heinrichs-2 wrote:
>> I'm currently facing strange behaviour on one client machine, which looks
>> like:
>>
>> [...]
>> heini@gondolin ~ % LANG="" ll /afs/altum.de
>> ls: cannot access /afs/altum.de/music: No such file or directory
>>
>
> I had the same problem after compiling a new kernel. However,
> I have discovered meanwhile that it is caused by the
> gcc version used: The 2.6.21.1 to 2.6.21.7 kernels all do NOT
> work with openafs-1.4.4 when compiled with gcc-4.2 (although
> both compile, and the driver is loaded -- only the afs cannot be
> accessed), whereas they work if compiled with gcc-4.0.
>
>
> Regards,
> Norbert
Anyone care to test out the attached patch for src/dir/dir.c
The hashing code in the DirHash() function relies on integer overflow to
make the hval value turn into a negative value. gcc 4.2 assumes that
this value can never go negative and optimizes out the (hval < 0) test.
Marc
--Boundary_(ID_V5syCXgy8SDDgedaatULpw)
Content-type: text/plain; CHARSET=US-ASCII; name=gcc_patch
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=gcc_patch
Index: src/dir/dir.c
===================================================================
RCS file: /cvs/openafs/src/dir/dir.c,v
retrieving revision 1.24
diff -u -r1.24 dir.c
--- src/dir/dir.c 13 Oct 2005 15:12:12 -0000 1.24
+++ src/dir/dir.c 7 Oct 2007 17:10:37 -0000
@@ -478,8 +478,9 @@
{
/* Hash a string to a number between 0 and NHASHENT. */
register unsigned char tc;
- register int hval;
+ unsigned long hval;
register int tval;
+
hval = 0;
while ((tc = (*string++))) {
hval *= 173;
@@ -488,7 +489,7 @@
tval = hval & (NHASHENT - 1);
if (tval == 0)
return tval;
- else if (hval < 0)
+ else if (hval >= 1<<31)
tval = NHASHENT - tval;
return tval;
}
--Boundary_(ID_V5syCXgy8SDDgedaatULpw)--