xfs
[Top] [All Lists]

[Bug 374] New: dm_{read,write}_invis leaks file handles in the kernel

To: xfs-master@xxxxxxxxxxx
Subject: [Bug 374] New: dm_{read,write}_invis leaks file handles in the kernel
From: bugzilla-daemon@xxxxxxxxxxx
Date: Wed, 13 Oct 2004 17:46:29 -0700
Sender: linux-xfs-bounce@xxxxxxxxxxx
http://oss.sgi.com/bugzilla/show_bug.cgi?id=374

           Summary: dm_{read,write}_invis leaks file handles in the kernel
           Product: Linux XFS
           Version: Current
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: High
         Component: dmapi
        AssignedTo: xfs-master@xxxxxxxxxxx
        ReportedBy: mmontour@xxxxxxxxxx


With the linux-2.4-xfs CVS tree from oss.sgi.com, each call to dm_read_invis or
dm_write_invis will leak 1 file handle within the kernel. This is visible by
inspecting /proc/sys/fs/file-nr.

Starting point:
test-40:~# cat /proc/sys/fs/file-nr
7020    9       52420

After running a loop calling dm_read_invis on a file on a DMAPI-managed 
filesystem:

test-40:~# cat /proc/sys/fs/file-nr
15975   1       52420

The first column shows an increasing number of allocated file handles.
Eventually this will reach the system maximum (3rd column), and other
applications running on the server will experience ENFILE errors.

The relevant code appears to be xfs_dm_rdwr() in fs/xfs/xfs_dmapi.c, which does:

        struct file     *file;
...
        file = dentry_open(dentry, NULL, oflags);
        if (IS_ERR(file)) {
                /* dentry_open did the dput */
                if (fmode & FMODE_WRITE)
                        put_write_access(inode);
                return EINVAL;
        }
        file->f_op = &linvfs_invis_file_operations;
...
        if (file->f_op->release)
                file->f_op->release(file->f_dentry->d_inode, file);
        if ((fmode & FMODE_WRITE) && have_write_access)
                put_write_access(inode);
        dput(dentry);
        return error;
}

"file" itself is never released here, e.g. with "put_filp(file)".



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


<Prev in Thread] Current Thread [Next in Thread>
  • [Bug 374] New: dm_{read,write}_invis leaks file handles in the kernel, bugzilla-daemon <=