Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Kernel v2.6.25-rc9 /fs/anon_inodes.c

Filename:/fs/anon_inodes.c
Lines Added:8
Lines Deleted:10
Also changed in: (Previous) 2.6.25-rc8  2.6.25-rc7  2.6.24  2.6.24-rc8  2.6.24-rc7  2.6.24-rc6 
(Following) 2.6.25  2.6.25-git19  2.6.25-git20  2.6.26-rc1  2.6.26-rc2  2.6.26-rc3 

Location
[  2.6.25-rc9
  [  fs
     o  anon_inodes.c

Patch

diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 2332188..f42be06 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -81,13 +81,10 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
 
    if (IS_ERR(anon_inode_inode))
       return -ENODEV;
-   file = get_empty_filp();
-   if (!file)
-      return -ENFILE;
 
    error = get_unused_fd();
    if (error < 0)
-      goto err_put_filp;
+      return error;
    fd = error;
 
    /*
@@ -114,14 +111,15 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
    dentry->d_flags &= ~DCACHE_UNHASHED;
    d_instantiate(dentry, anon_inode_inode);
 
-   file->f_path.mnt = mntget(anon_inode_mnt);
-   file->f_path.dentry = dentry;
+   error = -ENFILE;
+   file = alloc_file(anon_inode_mnt, dentry,
+           FMODE_READ | FMODE_WRITE, fops);
+   if (!file)
+      goto err_dput;
    file->f_mapping = anon_inode_inode->i_mapping;
 
    file->f_pos = 0;
    file->f_flags = O_RDWR;
-   file->f_op = fops;
-   file->f_mode = FMODE_READ | FMODE_WRITE;
    file->f_version = 0;
    file->private_data = priv;
 
@@ -132,10 +130,10 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
    *pfile = file;
    return 0;
 
+err_dput:
+   dput(dentry);
 err_put_unused_fd:
    put_unused_fd(fd);
-err_put_filp:
-   put_filp(file);
    return error;
 }
 EXPORT_SYMBOL_GPL(anon_inode_getfd);


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.