Bug 490181 - NFS: an f_mode/f_flags confusion in fs/nfs/write.c
Summary: NFS: an f_mode/f_flags confusion in fs/nfs/write.c
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.3
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Jeff Layton
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-13 17:37 UTC by Konstantin Khorenko
Modified: 2011-12-26 02:38 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 08:58:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:1243 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 5.4 kernel security and bug fix update 2009-09-01 08:53:34 UTC

Description Konstantin Khorenko 2009-03-13 17:37:26 UTC
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>
==================================================================
--- ./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,
Parallels

Comment 1 Jeff Layton 2009-05-13 11:06:16 UTC
Ouch -- good catch. Let's see if we can't get this fixed in 5.4.

Comment 2 RHEL Program Management 2009-05-13 11:20:15 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 4 Don Zickus 2009-05-19 19:46:32 UTC
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 08:58:38 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-1243.html


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