[OpenAFS-devel] Odd Behavior with 1.4.2fc3

Jason McCormick jasonmc@cert.org
Tue, 19 Sep 2006 09:44:25 -0400


Jeffrey Hutzelman wrote:

> It seems like it would be a good idea to run strace on this, and observe
> - If it's calling stat(), whether the returned size is correct\

nsgmls is calling fstat64() on the file.  A more verbose strace has
yielded what might be the problem.  The fstat64() call is returning 0
for st_blksize.  On a FC5 (2.6.17) box with 1.4.1, here's the fstat64()
call in question:

open("RPMS", O_RDONLY) = 3
fstat64(3, {st_dev=makedev(0, 19), st_ino=20447280,
st_mode=S_IFREG|0444, st_nlink=1, st_uid=16383, st_gid=16383,
st_blksize=4096, st_blocks=67816, st_size=34720773,
st_atime=2006/09/19-06:45:20, st_mtime=2006/09/19-06:45:20,
st_ctime=2006/09/19-06:45:20}) = 0

However on another FC5 with the only difference being OpenAFS 1.4.2fc3,
the fstat64() is:

open("RPMS", O_RDONLY) = 3
fstat64(3, {st_dev=makedev(0, 20), st_ino=20447280,
st_mode=S_IFREG|0444, st_nlink=1, st_uid=16383, st_gid=16383,
st_blksize=0, st_blocks=67816, st_size=34720773,
st_atime=2006/09/19-06:45:20, st_mtime=2006/09/19-06:45:20,
st_ctime=2006/09/19-06:45:20}) = 0

> - What count is actually being passed to read(), and what is returned.

That difference is then passed down to read().  On the read on the
1.4.2fc3 machine, the program reads nothing from 0 blocks:

read(3, "", 0)

on the working 1.4.1 machine, it makes a read and retrieves the first 4k
blocks:

read(3, "<?xml ....... ", 4096) = 4096

So nsgmls is trying to be efficient with its memory for reading (which
is a good thing for XML parsing) but it's being led astray with the
wrong fstat64() return. because it's trying to read in st_blksize chunks.

I'm working on a small test case to show this better.

-- 
Jason McCormick <jasonmc@cert.org>
CERT Infrastructure Group