Bug 1211013

Summary: NFS client mounted via flex-files layout reads past EOF if O_DIRECT and block size >= 512k
Product: [Fedora] Fedora Reporter: Jean Spector <jean>
Component: kernelAssignee: nfs-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: gansalmon, itamar, jean, jonathan, kernel-maint, madhu.chinakonda, mchehab, steved
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard: Flexfile layouts
Fixed In Version: kernel-4.0.1-300.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-30 13:57:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Network traces with EOF none

Description Jean Spector 2015-04-12 06:06:55 UTC
Created attachment 1013565 [details]
Network traces with EOF

Description of problem:
NFS client mounted using flex-files layout reads past EOF (forever) if both conditions are true:

* open O_DIRECT
* block size >= 512k

Version-Release number of selected component (if applicable):
* Client fedora rawhide 4.0.0-0.rc5.git4.1.fc23.x86_64
* Primary Data MDS b630 3.11.9-integration-630-90182a7f

How reproducible:
Every time

Steps to Reproduce:
> mount pd-mds:/share1 /mnt/test
> perl -e 'print "x" x 1048576' > /mnt/test/jean-test
> dd bs=512k of=/dev/null if=/mnt/test/jean-test iflag=direct

Actual results:
The client keeps "reading" forever or until the target fills up.
Note that the client is writing the last chunk it read continuously to the output file, even though it gets 0 bytes on subsequent reads.

Expected results:
The client stops reading upon reaching EOF

Additional info:
* I see partial reads being reported, but adding iflag=fullblock doesn't change the behavior (but removes the warning)
* Mount options
> pd-mds:/share1 on /mnt/test type nfs4 (rw,relatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=X.X.X.X,local_lock=none,addr=Y.Y.Y.Y)
* Network traces attached

Comment 1 Jean Spector 2015-04-16 05:43:45 UTC
Fixing patch: http://www.spinics.net/lists/linux-nfs/msg50654.html

Comment 2 Josh Boyer 2015-04-21 12:19:21 UTC
That patch has been sitting uncommented on a for a while now.  I poked the upstream thread to see if why.

Out of curiosity, did you happen to build a kernel with those and test?

Comment 3 Josh Boyer 2015-04-27 13:26:02 UTC
OK, this patch finally went upstream.  It should be in the 4.1-rc1 build today.

Comment 4 Josh Boyer 2015-04-27 15:15:46 UTC
Fixed in rawhide and in git for F22.

Comment 5 Jean Spector 2015-04-29 15:06:35 UTC
Verified on rawhide running kernel 4.1.0-0.rc1.git0.1.fc23.x86_64

Comment 6 Fedora Update System 2015-04-30 12:25:00 UTC
kernel-4.0.1-300.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/kernel-4.0.1-300.fc22

Comment 7 Fedora Update System 2015-05-03 17:22:31 UTC
kernel-4.0.1-300.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.