Bug 460063 - CIFS option forcedirectio fails to allow the appending of text to files.
CIFS option forcedirectio fails to allow the appending of text to files.
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
urgent Severity urgent
: rc
: ---
Assigned To: Jeff Layton
Martin Jenner
: ZStream
Depends On:
Blocks: 635495 462591
  Show dependency treegraph
Reported: 2008-08-25 17:22 EDT by Robert Jackson
Modified: 2015-02-24 17:56 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-01-20 14:38:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
sosreport from client machine (293.01 KB, application/x-bzip)
2008-08-26 08:58 EDT, Robert Jackson
no flags Details
dmesg from client machine (79.46 KB, text/plain)
2008-08-26 08:59 EDT, Robert Jackson
no flags Details
upstream proposed patch (2.09 KB, patch)
2008-08-28 08:14 EDT, Jeff Layton
no flags Details | Diff

  None (edit)
Description Robert Jackson 2008-08-25 17:22:58 EDT
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.

Additional info:
Comment 1 Robert Jackson 2008-08-26 08:58:50 EDT
Created attachment 314991 [details]
sosreport from client machine
Comment 2 Robert Jackson 2008-08-26 08:59:39 EDT
Created attachment 314992 [details]
dmesg from client machine
Comment 5 Issue Tracker 2008-08-27 13:48:42 EDT
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 
 issue 214836
Comment 6 Jeff Layton 2008-08-27 15:32:21 EDT
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 08:14:47 EDT
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 Product and Program Management 2008-09-03 08:24:29 EDT
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
Comment 12 Don Zickus 2008-09-09 17:16:51 EDT
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 11:47:13 EDT
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 14:41:27 EST
Verified that the bug is fixed in RHEL 5.3 beta
Comment 20 IBM Bug Proxy 2008-11-05 15:22:57 EST
(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 08:21:25 EST
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
Comment 26 errata-xmlrpc 2009-01-20 14:38:24 EST
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.


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