Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 460063

Summary: CIFS option forcedirectio fails to allow the appending of text to files.
Product: Red Hat Enterprise Linux 5 Reporter: Robert Jackson <rjackson>
Component: kernelAssignee: Jeff Layton <jlayton>
Status: CLOSED ERRATA QA Contact: Martin Jenner <mjenner>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.2CC: bugproxy, dhoward, jpirko, jplans, mdavis, steved, tao, vanhoof
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 19:38:24 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:
Bug Depends On:    
Bug Blocks: 462591, 635495    
Attachments:
Description Flags
sosreport from client machine
none
dmesg from client machine
none
upstream proposed patch none

Description Robert Jackson 2008-08-25 21:22:58 UTC
Description of problem: When using the CIFS option forcedirectio, any attempt to append to an open file on a CIFS share will result in that file being overwritten.


Version-Release number of selected component (if applicable): Present in kernel-2.6.18-104.el5.jtltest.47.x86_64.rpm.


How reproducible: Always

Steps to Reproduce:
1.Mount share with forcedirectio option
2.echo "foobar" >> /some/file/with/existing/text
3.
  
Actual results: The file receiving the echoed text will be completely overwritten.


Expected results: The text should be appended to the file, preserving any existing data.


Additional info:

Comment 1 Robert Jackson 2008-08-26 12:58:50 UTC
Created attachment 314991 [details]
sosreport from client machine

Comment 2 Robert Jackson 2008-08-26 12:59:39 UTC
Created attachment 314992 [details]
dmesg from client machine

Comment 5 Issue Tracker 2008-08-27 17:48:42 UTC
Customer reports this issue as present in the latest shipping kernel for
5u3:
kernel-2.6.18-92.1.10.el5.x86_64

root]# uname -a
Linux wlt.ldenergy.net 2.6.18-92.1.10.el5 #1 SMP Wed Jul 23 03:56:11 EDT
2008 x86_64 x86_64 x86_64 GNU/Linux

root]# cat /etc/fstab
//wltsan01/orabkupstg   /staging   cifs   
_netdev,forcedirectio,credentials=/root/staging.creds,domain=ldhenergy,uid=oracle,gid=dba,file_mode=0770,dir_mode=0770
 
[root]# cat testb
yes
howareyou
[root]# echo 123 >> testb
[root]# cat testb
123
howareyou


Issue escalated to RHEL 5 Kernel by: jpayne.
Internal Status set to 'Waiting on Engineering'

This event sent from IssueTracker by jpayne 
 issue 214836

Comment 6 Jeff Layton 2008-08-27 19:32:21 UTC
Did a Q&D patch that adds a call to generic_write_checks() to cifs_user_write().

It seems to fix the problem, but in my research, it also looks like there might be inherent problems with O_APPEND and direct I/O on network protocols. NFS doesn't have an equivalent mount option for direct I/O, but trying to open a file with O_DIRECT|O_APPEND will throw an error. The protocol doesn't allow the proper atomicity guarantees to allow that to work reliably.

The question is whether the CIFS protocol does...

Comment 7 Jeff Layton 2008-08-28 12:14:47 UTC
Created attachment 315202 [details]
upstream proposed patch

Should apply fairly cleanly to RHEL5 too. I'm still working on getting explanation of why NFS expressly forbids O_APPEND|O_DIRECT, but if they want to test this then they're welcome to do so. I'll also plan to add this to my test kernels in the near future.

Comment 9 RHEL Program Management 2008-09-03 12:24:29 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 12 Don Zickus 2008-09-09 21:16:51 UTC
in kernel-2.6.18-109.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Comment 17 IBM Bug Proxy 2008-10-08 15:47:13 UTC
As per todays bug call:
The customer issue is closed on RH site -> that means customer has fix and no issues reported
Also this is accepted for 5.3

Comment 19 IBM Bug Proxy 2008-11-05 19:41:27 UTC
Verified that the bug is fixed in RHEL 5.3 beta

Comment 20 IBM Bug Proxy 2008-11-05 20:22:57 UTC
(In reply to comment #13)

Closing this bug based upon the verification

> Verified that the bug is fixed in RHEL 5.3 beta
>

Comment 24 IBM Bug Proxy 2008-12-03 13:21:25 UTC
Hello,
This has also been shipped via RHEL5.2.z.stream, as  RHN-errata in November
2008.
Related RH BZ 462591 is closed with errata -> shipped with November RHN update

Comment 26 errata-xmlrpc 2009-01-20 19:38:24 UTC
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 therefore 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-2009-0225.html