Red Hat Bugzilla – Bug 460063
CIFS option forcedirectio fails to allow the appending of text to files.
Last modified: 2015-02-24 17:56:01 EST
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
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.
Created attachment 314991 [details]
sosreport from client machine
Created attachment 314992 [details]
dmesg from client machine
Customer reports this issue as present in the latest shipping kernel for
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
[root]# cat testb
[root]# echo 123 >> testb
[root]# cat testb
Issue escalated to RHEL 5 Kernel by: jpayne.
Internal Status set to 'Waiting on Engineering'
This event sent from IssueTracker by jpayne
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...
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.
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
You can download this test kernel from http://people.redhat.com/dzickus/el5
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
Verified that the bug is fixed in RHEL 5.3 beta
(In reply to comment #13)
Closing this bug based upon the verification
> Verified that the bug is fixed in RHEL 5.3 beta
This has also been shipped via RHEL5.2.z.stream, as RHN-errata in November
Related RH BZ 462591 is closed with errata -> shipped with November RHN update
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.