Red Hat Bugzilla – Bug 178720
O_DIRECT bug when reading last block of sparse file
Last modified: 2007-11-30 17:07:22 EST
+++ This bug was initially created as a clone of Bug #169243 +++ Escalated to Bugzilla from IssueTracker When reading the last block of a sparse file opened with O_DIRECT, we get a premature EOF instead of a short read. Steps to reproduce: # gcc -o directio directio.c # ./directio foo The output will look something like this without the patch: creating test file of size 4097...done performing test... Read 4096 total bytes out of 4097. Test Failed. You will see a "success" indication when the patch is applied. How reproducible? Always.
Created attachment 123587 [details] test program to reproduce a short O_DIRECT read of the last block in a sparse file
Created attachment 123592 [details] patch proposed upstream to fix this problem
committed in stream U4 build 34.6. A test kernel with this patch is available from http://people.redhat.com/~jbaron/rhel4/
[mpg@belenus test]$ ./directio testfile creating test file of size 4097...done performing test... Read 4096 total bytes out of 4097. Test Failed. [mpg@belenus test]$ uname -a Linux belenus 2.6.9-34.EL #1 Fri Feb 24 16:44:51 EST 2006 i686 i686 i386 GNU/Linux [root@dhcp59-204 178720]# ./directio64 test creating test file of size 4097...done performing test... short read: 1 out of 4096 bytes Read 4097 total bytes out of 4097. Test Passed. [root@dhcp59-204 178720]# ./directio test creating test file of size 4097...done performing test... short read: 1 out of 4096 bytes Read 4097 total bytes out of 4097. Test Passed. [root@dhcp59-204 178720]# uname -a Linux dhcp59-204.rdu.redhat.com 2.6.9-39.EL #1 Thu Jun 1 17:47:54 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux looks good at least on x86_64 & x86
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2006-0575.html