[2560] in Athena Bugs
[Bill Sommerfeld: [Mike Kazar: Re: More info on afs failure.]]
daemon@ATHENA.MIT.EDU (probe@ATHENA.MIT.EDU)
Thu Jul 13 14:30:48 1989
From: <probe@ATHENA.MIT.EDU>
Date: Thu, 13 Jul 89 14:30:23 -0400
To: bugs@ATHENA.MIT.EDU
Reply-To: Richard Basch <probe@ATHENA.MIT.EDU>
This is the hc2 failure with AFS... logging this message for
posterity... hc2.1d and hc2.1o both fail...
-Richard
------- Forwarded Message
Date: Tue, 25 Apr 89 00:05:39 EDT
From: Bill Sommerfeld <wesommer@ATHENA.MIT.EDU>
To: Richard Basch <probe@ATHENA.MIT.EDU>
Subject: [Mike Kazar: Re: More info on afs failure.]
This is what Kazar sent me.
You can run the grep needed to find the code in question just as
easily as I can.
- Bill
------- Forwarded Message
Date: Sun, 23 Apr 89 23:24:11 -0400 (EDT)
From: Mike Kazar <kazar+@andrew.cmu.edu>
To: Bill Cattey <wdc@ATHENA.MIT.EDU>, wesommer@ATHENA.MIT.EDU,
jis@ATHENA.MIT.EDU
Subject: Re: More info on afs failure.
In-Reply-To: <AYIcbP8GG0470a61h2@athena.mit.edu>
References: <AYIcbP8GG0470a61h2@athena.mit.edu>
Actually, this bug is so familiar that I'm going to make some predictions:
1. The problem only occurs on RTs.
2. The problem only occurs on RTs whose kernels are compiled with the dreaded
MetaWare HC 2.1 compiler.
3. The problem is that in the section of code you mailed me (good job in
localizing it so quickly, by the way)!
if (!tfile) panic("afswrite open");
len = totalLength; /* write this amount by default */
max = AFS_CHUNKTOSIZE(tdc->f.chunk); /* max size of this chunk */
if (max < len + offset) { /*if we'd go past the end of this chunk */
/* it won't all fit in this chunk, so write as much
as will fit */
len = max - offset;
if (afs_debug & AFSDEB_GENERAL) afs_dp("write doesn't all fit, chunk
size %d, newlen %d\n", max, len);
}
the worthless compiler (sorry for the gratuitous adjectives) thinks that
"offset" is dead when it evaluates "len + offset" in the "if" statement body.
Thus, it cleverly adds len to offset (which is in a register) since that
generates better code. Except that "offset" isn't dead; it is used in the body
of the "then" clause of the "if" statement:
len = max - offset
which effectively makes it compute:
len = max - (offset + len)
resulting in a negative new length.
We saw this problem in the latest RT kernel a while ago. The current AFS
installation notes caution people against using MetaWare 2.1 for building RT
kernels (or any other programs that have to "work").
Fix: recompile using MetaWare 1.4u or whatever you've got that doesn't start
with a 2. You probably should recompile the entire kernel, frankly, since we
don't know what else the compiler screws up.
Mike
------- End Forwarded Message
------- End Forwarded Message