Bug 647245 - Direct IO write to a file on an nfs mount does not work
Summary: Direct IO write to a file on an nfs mount does not work
Keywords:
Status: CLOSED DUPLICATE of bug 647297
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.5.z
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: rc
: ---
Assignee: Steve Dickson
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard: Storage
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-27 16:57 UTC by Saggi Mizrahi
Modified: 2015-03-02 05:22 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 647297 (view as bug list)
Environment:
Last Closed: 2010-10-28 20:01:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Program to test (734 bytes, text/plain)
2010-10-27 16:57 UTC, Saggi Mizrahi
no flags Details

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...


Note You need to log in before you can comment on or make changes to this bug.