Re: + kmod-avoid-deadlock-by-recursive-kmod-call.patch added to-mm tree

From: Oleg Nesterov
Date: Fri Jan 27 2012 - 09:38:55 EST


On 01/27, Rusty Russell wrote:
>
> On Thu, 26 Jan 2012 18:56:12 +0100, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> > > @@ -449,6 +460,16 @@ int call_usermodehelper_exec(struct subp
> > > retval = -EBUSY;
> > > goto out;
> > > }
> > > + /*
> > > + * Worker thread must not wait for khelper thread at below
> > > + * wait_for_completion() if the thread was created with CLONE_VFORK
> > > + * flag, for khelper thread is already waiting for the thread at
> > > + * wait_for_completion() in do_fork().
> > > + */
> > > + if (wait != UMH_NO_WAIT && current == kmod_thread_locker) {
> > > + retval = -EBUSY;
> > > + goto out;
> > > + }
> >
> > So, this is because khelper_wq's max_active == 1.
> >
> > Can't we simply kill khelper_wq and use system_unbound_wq instead?
>
> I'd prefer that, because then we'd hit the existing "too many modprobes"
> check.

Hmm. Why? I mean, why do you think that s/khelper_wq/system_unbound_wq/
leads to recursive __request_module's ?

Note that that this patch (which adds kmod_thread_locker) can not limit
the recursive modprobe loop.


OK, yes, with system_unbound_wq we can hit this warning if we have
max_modprobes UMH_WAIT_EXEC's resulting in __request_module at the
same time, but probably this is good?

I guess I missed something, could you explain? Just curious.

Oleg.

--
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/