[OpenAFS] Strange access problems on one client
Derrick Brashear
shadow@gmail.com
Sun, 7 Oct 2007 15:44:52 -0400
------=_Part_17029_23985266.1191786292767
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Omari Stephens confirmed this fixed a test system, and regardless it's
harmless, so we'll run with this.
Thanks!
On 10/7/07, Marc Dionne <marc.dionne@technoconseil.com> wrote:
>
> 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
>
>
> 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;
> }
>
>
------=_Part_17029_23985266.1191786292767
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<span class="ppt" id="_user_xsdg@mit.edu">Omari Stephens confirmed this fixed a test system, and regardless it's harmless, so we'll run with this.<br><br>Thanks!<br><span class="lg"></span></span><br><br><div><span class="gmail_quote">
On 10/7/07, <b class="gmail_sendername">Marc Dionne</b> <<a href="mailto:marc.dionne@technoconseil.com">marc.dionne@technoconseil.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Norbert Schuch wrote:<br>> Hi,<br>><br>><br>> Dirk Heinrichs-2 wrote:<br>>> I'm currently facing strange behaviour on one client machine, which looks<br>>> like:<br>>><br>>> [...]<br>
>> heini@gondolin ~ % LANG="" ll /afs/altum.de<br>>> ls: cannot access /afs/altum.de/music: No such file or directory<br>>><br>><br>> I had the same problem after compiling a new kernel. However,
<br>> I have discovered meanwhile that it is caused by the<br>> gcc version used: The <a href="http://2.6.21.1">2.6.21.1</a> to <a href="http://2.6.21.7">2.6.21.7</a> kernels all do NOT<br>> work with openafs-1.4.4
when compiled with gcc-4.2 (although<br>> both compile, and the driver is loaded -- only the afs cannot be<br>> accessed), whereas they work if compiled with gcc-4.0.<br>><br>><br>> Regards,<br>> Norbert
<br><br>Anyone care to test out the attached patch for src/dir/dir.c<br><br>The hashing code in the DirHash() function relies on integer overflow to<br>make the hval value turn into a negative value. gcc 4.2 assumes that
<br>this value can never go negative and optimizes out the (hval < 0) test.<br><br>Marc<br><br><br>Index: src/dir/dir.c<br>===================================================================<br>RCS file: /cvs/openafs/src/dir/dir.c,v
<br>retrieving revision 1.24<br>diff -u -r1.24 dir.c<br>--- src/dir/dir.c 13 Oct 2005 15:12:12 -0000 1.24<br>+++ src/dir/dir.c 7 Oct 2007 17:10:37 -0000<br>@@ -478,8 +478,9 @@<br> {<br> /* Hash a string to a number between 0 and NHASHENT. */
<br> register unsigned char tc;<br>- register int hval;<br>+ unsigned long hval;<br> register int tval;<br>+<br> hval = 0;<br> while ((tc = (*string++))) {<br> hval *= 173;<br>@@ -488,7 +489,7 @@
<br> tval = hval & (NHASHENT - 1);<br> if (tval == 0)<br> return tval;<br>- else if (hval < 0)<br>+ else if (hval >= 1<<31)<br> tval = NHASHENT - tval;<br> return tval;<br> }
<br><br></blockquote></div><br>
------=_Part_17029_23985266.1191786292767--