Bug 647245

Summary: Direct IO write to a file on an nfs mount does not work
Product: Red Hat Enterprise Linux 5 Reporter: Saggi Mizrahi <smizrahi>
Component: kernelAssignee: Steve Dickson <steved>
Status: CLOSED DUPLICATE QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: urgent Docs Contact:
Priority: high    
Version: 5.5.zCC: abaron, apevec, bazulay, bfields, cpelland, dhoward, iheim, jlayton, jpirko, jturner, mburns, mzywusko, smizrahi, steved
Target Milestone: rcKeywords: Regression, TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 647297 (view as bug list) Environment:
Last Closed: 2010-10-28 20:01:27 UTC Type: ---
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
Program to test none

Description Saggi Mizrahi 2010-10-27 16:57:12 UTC
Created attachment 456028 [details]
Program to test

Description of problem:
If you try to do a Direct IO write operation you get ENOMEM. I've seen this happen on `2.6.18-194.24.1.el5` but not on `2.6.18-194.17.1.el5`

I've attached a small c program to test this. Just run
$ nfsdio /path/to/mounted/nfs

It should work. And it always works on local file systems so they could be used to test for validity of the code.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 Jeff Layton 2010-10-27 18:53:17 UTC
Looks like the bug is this condition in nfs_direct_write:

        dreq->l_ctx = nfs_get_lock_context(dreq->ctx);
        if (dreq->l_ctx != NULL)
                goto out_release;

...that should be a "== NULL". It's also broken upstream, so this needs to be fixed there too (and probably cc stable).

Comment 3 Steve Dickson 2010-10-27 19:15:22 UTC
--- ./fs/nfs/direct.c.save	2010-09-22 08:38:17.000000000 -0400
+++ ./fs/nfs/direct.c	2010-10-27 15:11:48.000000000 -0400
@@ -726,7 +726,7 @@ static ssize_t nfs_direct_write(struct k
 	dreq->inode = inode;
 	dreq->ctx = get_nfs_open_context((struct nfs_open_context *)iocb->ki_filp->private_data);
 	dreq->l_ctx = nfs_get_lock_context(dreq->ctx);
-	if (dreq->l_ctx != NULL)
+	if (dreq->l_ctx == NULL)
 		goto out_release;
 	if (!is_sync_kiocb(iocb))
 		dreq->iocb = iocb;


Does indeed fix the problem...