From: Eric Dumazet <eric.dumazet@gmail.com>
To: Martin Sustrik <sustrik@250bpm.com>
Cc: netdev@vger.kernel.org, Martin Lucina <mato@kotelna.sk>
Subject: Re: Polling on sockets in kernel space and struct file
Date: Wed, 08 Dec 2010 16:02:53 +0100 [thread overview]
Message-ID: <1291820573.2883.56.camel@edumazet-laptop> (raw)
In-Reply-To: <4CFF9757.3070100@250bpm.com>
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
next prev parent reply other threads:[~2010-12-08 15:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-08 14:33 Polling on sockets in kernel space and struct file Martin Sustrik
2010-12-08 15:02 ` Eric Dumazet [this message]
2010-12-08 15:16 ` Martin Lucina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291820573.2883.56.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=mato@kotelna.sk \
--cc=netdev@vger.kernel.org \
--cc=sustrik@250bpm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox