Red Hat Bugzilla – Bug 136398
NFS direct reads don't flush dirty cached pages
Last modified: 2007-11-30 17:07:04 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2)
Description of problem:
The NFS direct I/O patch applied to RHEL 3.0 update 3 has a minor bug
that was found during testing with fsx-odirect. The fix is in
function nfs_file_direct_IO in fs/nfs/direct.c:
retval = filemap_fdatasync(mapping);
if (retval == 0)
- retval = fsync_inode_data_buffers(inode);
+ retval = nfs_wb_all(inode);
if (retval == 0)
retval = filemap_fdatawait(mapping);
fsync_inode_data_buffers() comes from the normal direct I/O path, but
since NFS doesn't use inode data buffers, it is a no-op in the NFS
direct I/O path. nfs_wb_all is the correct function to call here.
Note that there are no real applications I'm aware of that access a
file via direct I/O and writable map simultaneously.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. mmap a file in NFS, and open it with O_DIRECT
2. dirty the map with just a few bytes, then read from the O_DIRECT
file descriptor in quick succession
Actual Results: I did this with fsx-odirect. It dirtied 92KB of the
map, and the NFS client flushed only 64KB of the dirty pages before
the direct read operation.
Expected Results: All 92KB should have been written to the server
before the direct read operation.
The problem occurs because nfs_strategy only pushes writes out in
"wsize" chunks. nfs_wb_all pushes everything no matter how many NFS
write operations it takes.
Created attachment 105463 [details]
I'm hopeful that this will make into RHEL3-U5
A fix for this problem has just been committed to the RHEL3 U5
patch pool this evening (in kernel version 2.4.21-25.1.EL).
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.