[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1291820573.2883.56.camel@edumazet-laptop>
Date: Wed, 08 Dec 2010 16:02:53 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Martin Sustrik <sustrik@...bpm.com>
Cc: netdev@...r.kernel.org, Martin Lucina <mato@...elna.sk>
Subject: Re: Polling on sockets in kernel space and struct file
Le mercredi 08 décembre 2010 à 15:33 +0100, Martin Sustrik a écrit :
> Hi all,
>
> As part of implementing a new experimental protocol family, we are
> trying to create a socket in kernel. This seems to be easy, just use
> sock_create_kern(). However, the socket returned by this function does
> not have associated file structure; thus it cannot be polled on using
> poll_initwait() and friends.
>
> We have tried to create the appropriate struct file using sock_map_fd(),
> but this has two problems:
>
> 1) We do not want our internal socket to be visible in the process
> context, i.e. it should not have a file descriptor.
>
> 2) During process exit, we get a kernel BUG from iput() in fs/inode.c:1260.
>
you could call sock_map_fd() then :
int fd = sock_map_fd(sock, flags);
struct file *file = NULL;
if (fd != -1) {
file = fget(fd);
sys_close(fd); /* still racy */
}
if (file) ...
Take a look at net/9p/trans_fd.c
> We then tried another approach using anon_inode_getfile() to get a
> struct file, but this still produces the problem 2) above.
>
> Any help/advice on how to proceed would be appreciated; for reference
> our work in progress can be seen at
>
> http://github.com/sustrik/linux-2.6/blob/sp-v2.6.36/net/sp/af_sp.c
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists