Re: [RFC] RPCBIND: add anonymous listening socket in addition to named one

Stanislav Kinsbursky
2011-12-29T11:49:21Z

28.12.2011 22:22, bfields@fieldses.org пишет:
> On Wed, Dec 28, 2011 at 07:17:30PM +0400, Stanislav Kinsbursky wrote:
>> I've experienced a problem with registering Lockd service with
>> rpcbind in container. My container operates in it's own network
>> namespace context and has it's own root. But on service register,
>> kernel tries to connect to named unix socket by using
>> rpciod_workqueue. Thus any connect is done with the same fs->root,
>
> There's no way to pass the correct context down to the rpc task and from
> there to the registration code?
>

This context is current->fs->root. It's used to lookup unix socket inode by name
on connect.
Obviously, current is always "rpciod_workqueue" kernel thread. And thus has the
same root.
The only solution how to pass and use the context, which I can see, is to expand
sock_xprt with a pointer to corrent root and then set this root before
kernel_connect() and set the old one after.
But this looks ugly and too complicated for the issue, from my pow.
Or maybe you have some more elegant solution to this problem?