2 Mar 2009 22:10
pread/pwrite bug on linux (RHEL)?
Qiuyang Wu <Qiuyang.Wu <at> synopsys.com>
2009-03-02 21:10:46 GMT
2009-03-02 21:10:46 GMT
Hi All,
Are there any known bugs with pread/pwrite on RHEL Linux when the disk partition is close to full?
Reduced a complex application fatal down to a simple program just opens a regular file and performs 1M
sequential pwrite() of size 8KB blocks; at every 100th write, does a pread() to load the very first 8KB
block and validate its content still matching what was originally written.
What I observed are the following when running on different machines and writing/reading to a disk
partition nearly full with slightly more than 1GB of free space according to 'df' (the program is the only
process accessing the disk) -
* Linux 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux (RHEL4)
BEHAVIOR: pwrite() works for many iterations, then pread() suddenly returns data of the requested size
but filled with 0's, and strerror shows errno="No such file or directory", condition
if(size_to_read != pread(fd, buf, size_to_read, ...)) ...
is not triggered and application has to check errno immediately after every call to pread.
CONCLUSION: serious bug, why does pread() return the expected size filled with 0? and why doesn't pwrite()
fail earlier so application has a chance to bail out and stop pushing more data to the file?
* Linux 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64 x86_64 x86_64 GNU/Linux (RHEL5)
BEHAVIOR: pwrite() works for much fewer iterations, then pread() errors out again with errno="No such
file or directory", and condition (size_to_read!=pread(...)) is asserted at the meantime, which is
slightly better but application still very hard to recover.
CONCLUSION: Bug, still, pwrite() should error out earlier if not enough space to commit data, instead of
(Continue reading)
RSS Feed