Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934340AbcLOB0h (ORCPT ); Wed, 14 Dec 2016 20:26:37 -0500 Received: from ozlabs.org ([103.22.144.67]:33903 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933772AbcLOB0f (ORCPT ); Wed, 14 Dec 2016 20:26:35 -0500 From: Rusty Russell To: "Luis R. Rodriguez" , shuah@kernel.org, jeyu@redhat.com, ebiederm@xmission.com, dmitry.torokhov@gmail.com, acme@redhat.com, corbet@lwn.net Cc: martin.wilck@suse.com, mmarek@suse.com, pmladek@suse.com, hare@suse.com, rwright@hpe.com, jeffm@suse.com, DSterba@suse.com, fdmanana@suse.com, neilb@suse.com, linux@roeck-us.net, rgoldwyn@suse.com, subashab@codeaurora.org, xypron.glpk@gmx.de, keescook@chromium.org, atomlin@redhat.com, mbenes@suse.cz, paulmck@linux.vnet.ibm.com, dan.j.williams@intel.com, jpoimboe@redhat.com, davem@davemloft.net, mingo@redhat.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: Re: [RFC 10/10] kmod: add a sanity check on module loading In-Reply-To: <20161208194930.2816-1-mcgrof@kernel.org> References: <20161208184801.1689-1-mcgrof@kernel.org> <20161208194930.2816-1-mcgrof@kernel.org> User-Agent: Notmuch/0.22.1 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Thu, 15 Dec 2016 10:57:42 +1030 Message-ID: <87k2b2kpdt.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 744 Lines: 17 "Luis R. Rodriguez" writes: > kmod has an optimization in place whereby if a some kernel code > uses request_module() on a module already loaded we never bother > userspace as the module already is loaded. This is not true for > get_fs_type() though as it uses aliases. Well, the obvious thing to do here is block kmod if we're currently loading the same module. Otherwise it has to do some weird spinning thing in userspace anyway. We already have module_wq for this, we just need a bit more code to share the return value; and there's a weird corner case there where we have "modprobe foo param=invalid" then "modprobe foo param=valid" and we fail both with -EINVAL, but it's probably not worth fixing. Cheers, Rusty.