[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&#39;s harmless, so we&#39;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> &lt;<a href="mailto:marc.dionne@technoconseil.com">marc.dionne@technoconseil.com</a>&gt; 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>&gt; Hi,<br>&gt;<br>&gt;<br>&gt; Dirk Heinrichs-2 wrote:<br>&gt;&gt; I&#39;m currently facing strange behaviour on one client machine, which looks<br>&gt;&gt; like:<br>&gt;&gt;<br>&gt;&gt; [...]<br>
&gt;&gt; heini@gondolin ~ % LANG=&quot;&quot; ll /afs/altum.de<br>&gt;&gt; ls: cannot access /afs/altum.de/music: No such file or directory<br>&gt;&gt;<br>&gt;<br>&gt; I had the same problem after compiling a new kernel. However,
<br>&gt; I have discovered meanwhile that it is caused by the<br>&gt; 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>&gt; work with openafs-1.4.4
 when compiled with gcc-4.2 (although<br>&gt; both compile, and the driver is loaded -- only the afs cannot be<br>&gt; accessed), whereas they work if compiled with gcc-4.0.<br>&gt;<br>&gt;<br>&gt; Regards,<br>&gt; 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.&nbsp;&nbsp;gcc 4.2 assumes that
<br>this value can never go negative and optimizes out the (hval &lt; 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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 13 Oct 2005 15:12:12 -0000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.24<br>+++ src/dir/dir.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7 Oct 2007 17:10:37 -0000<br>@@ -478,8 +478,9 @@<br> {<br>&nbsp;&nbsp;&nbsp;&nbsp; /* Hash a string to a number between 0 and NHASHENT. */
<br>&nbsp;&nbsp;&nbsp;&nbsp; register unsigned char tc;<br>-&nbsp;&nbsp;&nbsp;&nbsp;register int hval;<br>+&nbsp;&nbsp;&nbsp;&nbsp;unsigned long hval;<br>&nbsp;&nbsp;&nbsp;&nbsp; register int tval;<br>+<br>&nbsp;&nbsp;&nbsp;&nbsp; hval = 0;<br>&nbsp;&nbsp;&nbsp;&nbsp; while ((tc = (*string++))) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hval *= 173;<br>@@ -488,7 +489,7 @@
<br>&nbsp;&nbsp;&nbsp;&nbsp; tval = hval &amp; (NHASHENT - 1);<br>&nbsp;&nbsp;&nbsp;&nbsp; if (tval == 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return tval;<br>-&nbsp;&nbsp;&nbsp;&nbsp;else if (hval &lt; 0)<br>+&nbsp;&nbsp;&nbsp;&nbsp;else if (hval &gt;= 1&lt;&lt;31)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tval = NHASHENT - tval;<br>&nbsp;&nbsp;&nbsp;&nbsp; return tval;<br> }
<br><br></blockquote></div><br>

------=_Part_17029_23985266.1191786292767--