aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p/trans_fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/9p/trans_fd.c')
-rw-r--r--net/9p/trans_fd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 6449bae1570..15656b8573f 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -793,30 +793,28 @@ static int p9_fd_open(struct p9_client *client, int rfd, int wfd)
793static int p9_socket_open(struct p9_client *client, struct socket *csocket) 793static int p9_socket_open(struct p9_client *client, struct socket *csocket)
794{ 794{
795 struct p9_trans_fd *p; 795 struct p9_trans_fd *p;
796 int ret, fd; 796 struct file *file;
797 int ret;
797 798
798 p = kmalloc(sizeof(struct p9_trans_fd), GFP_KERNEL); 799 p = kmalloc(sizeof(struct p9_trans_fd), GFP_KERNEL);
799 if (!p) 800 if (!p)
800 return -ENOMEM; 801 return -ENOMEM;
801 802
802 csocket->sk->sk_allocation = GFP_NOIO; 803 csocket->sk->sk_allocation = GFP_NOIO;
803 fd = sock_map_fd(csocket, 0); 804 file = sock_alloc_file(csocket, 0, NULL);
804 if (fd < 0) { 805 if (IS_ERR(file)) {
805 pr_err("%s (%d): failed to map fd\n", 806 pr_err("%s (%d): failed to map fd\n",
806 __func__, task_pid_nr(current)); 807 __func__, task_pid_nr(current));
807 sock_release(csocket); 808 sock_release(csocket);
808 kfree(p); 809 kfree(p);
809 return fd; 810 return PTR_ERR(file);
810 } 811 }
811 812
812 get_file(csocket->file); 813 get_file(file);
813 get_file(csocket->file); 814 p->wr = p->rd = file;
814 p->wr = p->rd = csocket->file;
815 client->trans = p; 815 client->trans = p;
816 client->status = Connected; 816 client->status = Connected;
817 817
818 sys_close(fd); /* still racy */
819
820 p->rd->f_flags |= O_NONBLOCK; 818 p->rd->f_flags |= O_NONBLOCK;
821 819
822 p->conn = p9_conn_create(client); 820 p->conn = p9_conn_create(client);
@@ -1083,7 +1081,7 @@ int p9_trans_fd_init(void)
1083 1081
1084void p9_trans_fd_exit(void) 1082void p9_trans_fd_exit(void)
1085{ 1083{
1086 flush_work_sync(&p9_poll_work); 1084 flush_work(&p9_poll_work);
1087 v9fs_unregister_trans(&p9_tcp_trans); 1085 v9fs_unregister_trans(&p9_tcp_trans);
1088 v9fs_unregister_trans(&p9_unix_trans); 1086 v9fs_unregister_trans(&p9_unix_trans);
1089 v9fs_unregister_trans(&p9_fd_trans); 1087 v9fs_unregister_trans(&p9_fd_trans);