Re: hang in call_usermodehelper_exec()

From: Neil Horman
Date: Mon Feb 22 2010 - 07:04:41 EST


On Mon, Feb 22, 2010 at 02:19:28PM +0800, Américo Wang wrote:
> On Thu, Feb 18, 2010 at 4:22 AM, Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
> > I was stress-testing netns stuff in presence of removing modules.
> >
> > Kernel is 2.6.33-rc8-next-20100217+:
> >
>
> I don't know if this kernel has Andi's patchset, which is:
>
> http://lkml.org/lkml/2010/1/4/506
>
> If yes, then please try Neil's patch:
>
> http://lkml.org/lkml/2010/2/12/181
>
> Thanks.
No, both Andi's and my usermodehelper changes aren't going in until .34 IIRC,
but that shouldn't matter, they weren't meant to fix hangs (not that they dont
:) ).

Looking at this, my guess is that your hang is in userspace, and that you have
an old version of module-utils. I fixed this with iptables awhile back. What
happens is that process 3737, the modprobe is removing modules, while the setkey
utility is requesting kernel services that require those modules, so you are in
fact trying to load and unload the same module(s) in parallel. While thats not
a huge deal, it results in the setkey utility forking another copy of modprobe
(using callusermode_helper). The two copies of modprobe actually take file
locks on the module they are workign with, serializing them in user space. If
the setkey path and the modprobe path serialize at all in kernel space (by
taking the module_mutex for instance), you get deadlock.

I fixed this by making modprobe be non-blocking in user space (which is the
default for insmod as well), and it fixed the problem. The gory details are
here:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=16fcec35e7d7c4faaa4709f6434a4a25b06d25e3

My guess is that if you get the latest module-utils you can make this go away.

Neil

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/