[OpenAFS] AFS write silently fails; local disk write works
Gregg Tracton
tracton@radonc.unc.edu
Tue, 10 Jun 2003 15:45:27 -0400
If we write a 150MB file from within a program to a local disk, it
appears to work fine - the contents of the file are as expected.
When we use the same program to write the file to an AFS 1.2.7
server (RH linux 7.2, kernel 2.4.7-10smp, 2 Pentium II CPUs), it
writes the first 4k of the file and quits. We have seen this
behavior when running the program on both solaris and windows, but
only on certain datasets.
So we copy that dandy local file (via Window's copy command) to AFS
and the file has the right size but the wrong contents (all but the
first 4k are zero'd out).
The AFS volume is 50% full. The volume's partition is 30% full. The
local client caches are set to 1GB -- how would I check how full the
caches are? This is reproducible even right after the machines have
been rebooted (an almost empty cache). The same datasets are
corrupted on AFS reproducibly (across clients, users, volumes) while
other datasets are written to AFS ok. The written files are mixed in
sizes (some OK files are larger than corrupted files; some smaller).
Since we've not seen this behavior in any other program, we figured
it must be our program. Here's the C++ source:
void RAWImageFile::write(const char * filename, const Image3D & image)
{
FILE * fp;
int xDim, yDim, zDim;
double xSpacing, ySpacing, zSpacing;
Vector3D originPos;
GreyValue * voxels;
fp = fopen(filename, "wb");
if(fp == NULL)
return;
xDim = image.getXDim();
yDim = image.getYDim();
zDim = image.getZDim();
xSpacing = image.getXSpacing();
ySpacing = image.getYSpacing();
zSpacing = image.getZSpacing();
originPos = image.getOriginPixelPos();
voxels = image.getVoxels();
fprintf(fp, "lsb ");
fprintf(fp, "%d %d %d ", xDim, yDim, zDim);
fprintf(fp, "%f %f %f ", xSpacing, ySpacing, zSpacing);
fprintf(fp, "%f %f %f ",
originPos.getX(), originPos.getY(), originPos.getZ());
fprintf(fp, "%d %d ", MIN_GREY_VALUE, MAX_GREY_VALUE);
fwrite(voxels, xDim * yDim * zDim, sizeof(GreyValue), fp);
fclose(fp);
}
--gregg