Bug 490181 - NFS: an f_mode/f_flags confusion in fs/nfs/write.c
NFS: an f_mode/f_flags confusion in fs/nfs/write.c
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
low Severity low
: rc
: ---
Assigned To: Jeff Layton
Red Hat Kernel QE team
Depends On:
  Show dependency treegraph
Reported: 2009-03-13 13:37 EDT by Konstantin Khorenko
Modified: 2011-12-25 21:38 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-09-02 04:58:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Konstantin Khorenko 2009-03-13 13:37:26 EDT
Description of problem:
nfs_updatepage() function contains following lines:
        if (nfs_write_pageuptodate(page, inode) &&
                        inode->i_flock == NULL &&
                        !(file->f_mode & O_SYNC)) {

This is a typo, O_SYNC is stored in filp->f_flags.

2.6.18-128.1.1 kernel is affected.

Mainstream has this issue already fixed:

Original git commit: 4b5621f6b127bce9218998c187bd25bf7f9fc371
NFS: Fix an f_mode/f_flags confusion in fs/nfs/write.c
Trond Myklebust [Mon, 25 Feb 2008 23:56:29 +0000 (15:56 -0800)]

O_SYNC is stored in filp->f_flags.
Thanks to Al Viro for pointing out the bug.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
--- ./fs/nfs/write.c.flags	2009-03-13 10:27:38.000000000 +0300
+++ ./fs/nfs/write.c	2009-03-13 10:35:18.000000000 +0300
@@ -875,7 +875,7 @@ int nfs_updatepage(struct file *file, st
 	if (nfs_write_pageuptodate(page, inode) &&
 			inode->i_flock == NULL &&
-			!(file->f_mode & O_SYNC)) {
+			!(file->f_flags & O_SYNC)) {
 		loff_t end_offs = i_size_read(inode) - 1;
 		unsigned long end_index = end_offs >> PAGE_CACHE_SHIFT;
Please, fix.
Thank you.

Best regards,

Konstantin Khorenko,
PVC/OpenVZ developer,
Comment 1 Jeff Layton 2009-05-13 07:06:16 EDT
Ouch -- good catch. Let's see if we can't get this fixed in 5.4.
Comment 2 RHEL Product and Program Management 2009-05-13 07:20:15 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 4 Don Zickus 2009-05-19 15:46:32 EDT
in kernel-2.6.18-149.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Please do NOT transition this bugzilla state to VERIFIED until our QE team
has sent specific instructions indicating when to do so.  However feel free
to provide a comment indicating that this fix has been verified.
Comment 8 errata-xmlrpc 2009-09-02 04:58:38 EDT
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.