Bug 313681

Summary: O_ATOMICLOOKUP vs O_CLOEXEC(mainstream kernels) incompatibility
Product: Red Hat Enterprise Linux 5 Reporter: Vasily Averin <vvs>
Component: kernelAssignee: Michal Schmidt <mschmidt>
Status: CLOSED DUPLICATE QA Contact: Martin Jenner <mjenner>
Severity: low Docs Contact:
Priority: low    
Version: 5.1CC: dzickus, esandeen, khorenko
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-12-05 08:58:52 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 358661    
Bug Blocks:    

Description Vasily Averin 2007-10-01 06:58:26 EDT
O_ATOMICLOOKUP in RHEL4 and RHEL5 kernels uses the same flag number that
O_CLOEXEC flag in latest mainstream kernels
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f23513e8d96cf5e6cf8d2ff0cb5dd6bbc33995e4
Comment 1 Vasily Averin 2007-10-01 09:04:31 EDT
btw I've found dentry leak in do_lookup():

fs/namei.c::
static int do_lookup(struct nameidata *nd, struct qstr *name,
                     struct path *path, int atomic)
{
        struct vfsmount *mnt = nd->mnt;
        struct dentry *dentry = __d_lookup(nd->dentry, name);

        if (!dentry)
                goto need_lookup;
        if (dentry->d_op && dentry->d_op->d_revalidate)
                goto need_revalidate;
>>>>> VvS: dentry was taken but requires revalidation 

need_revalidate:
        if (atomic)
                return -EWOULDBLOCKIO;
>>>>> VvS: ... however if atomic is set, we forget to call dput before exit
Comment 2 Jerome Marchand 2007-10-05 03:38:36 EDT
Both problem come from the TUX patch. I wonder if someone actually use it.
Comment 3 Vasily Averin 2007-10-05 04:12:57 EDT
I do not know who uses TUX, but people will use O_CLOEXEC in new binaries. And
it  will lead to the troubles on filesystems where d_revalidate is implemented.

Also It would be great to look at 
https://bugzilla.redhat.com/show_bug.cgi?id=315051
Comment 4 Jerome Marchand 2007-10-05 05:01:24 EDT
Yes sure. I wondered if we should get rid of TUX in the future. If it's not
used, it's just a source of trouble.
Comment 5 Eric Sandeen 2007-10-30 12:47:06 EDT
just a note that bug #315051: open(O_ATOMICLOOKUP) leaks dentry covers the leak
problem for RHEL5.
Comment 6 Michal Schmidt 2007-12-05 08:58:52 EST
I'll close it as a duplicate of bug 358661. It is a private bug for some reason,
but it says basically the same and it's already in POST status. It means a patch
has been proposed and it is considered for 5.2. The patch simply removes all
references to O_ATOMICLOOKUP from the kernel, because I found no users of it -
not even the userspace part of tux used it.

*** This bug has been marked as a duplicate of 358661 ***
Comment 7 Michal Schmidt 2008-01-09 12:51:53 EST
Quoting Don Zickus's comment from bug 358661:

in 2.6.18-62.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5