Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177388
b: refs/heads/master
c: cc3808f
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Dec 16, 2009
1 parent b7aa293 commit 2c74ae8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b18662e239a032f908b7f6e164bdf7e2e0a32c9
refs/heads/master: cc3808f8c354889982e7e323050f1e50ad99a009
22 changes: 11 additions & 11 deletions trunk/net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,8 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags)
if (unlikely(fd < 0))
return fd;

file = get_empty_filp();

if (unlikely(!file)) {
put_unused_fd(fd);
return -ENFILE;
}

dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name);
if (unlikely(!dentry)) {
put_filp(file);
put_unused_fd(fd);
return -ENOMEM;
}
Expand All @@ -388,11 +380,19 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags)
*/
dentry->d_flags &= ~DCACHE_UNHASHED;
d_instantiate(dentry, SOCK_INODE(sock));
SOCK_INODE(sock)->i_fop = &socket_file_ops;

sock->file = file;
init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
file = alloc_file(sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
&socket_file_ops);
SOCK_INODE(sock)->i_fop = &socket_file_ops;
if (unlikely(!file)) {
/* drop dentry, keep inode */
atomic_inc(&path.dentry->d_inode->i_count);
dput(dentry);
put_unused_fd(fd);
return -ENFILE;
}

sock->file = file;
file->f_flags = O_RDWR | (flags & O_NONBLOCK);
file->f_pos = 0;
file->private_data = sock;
Expand Down

0 comments on commit 2c74ae8

Please sign in to comment.