Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752778AbcKIKMF (ORCPT ); Wed, 9 Nov 2016 05:12:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60240 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751202AbcKIKMD (ORCPT ); Wed, 9 Nov 2016 05:12:03 -0500 Date: Wed, 9 Nov 2016 05:12:01 -0500 From: Jessica Yu To: Rusty Russell Cc: Aaron Tomlin , linux-kernel@vger.kernel.org, rostedt@goodmis.org Subject: Re: module: Ensure a module's state is set accordingly during module coming cleanup code Message-ID: <20161109101201.GA27196@packer-debian-8-amd64.digitalocean.com> References: <1476980293-19062-1-git-send-email-atomlin@redhat.com> <1476980293-19062-2-git-send-email-atomlin@redhat.com> <87funk3p6f.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87funk3p6f.fsf@rustcorp.com.au> X-OS: Linux eisen.io 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 09 Nov 2016 10:12:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1089 Lines: 28 +++ Rusty Russell [26/10/16 11:24 +1030]: >Aaron Tomlin writes: >> In load_module() in the event of an error, for e.g. unknown module >> parameter(s) specified we go to perform some module coming clean up >> operations. At this point the module is still in a "formed" state >> when it is actually going away. >> >> This patch updates the module's state accordingly to ensure anyone on the >> module_notify_list waiting for a module going away notification will be >> notified accordingly. > >I recall a similar proposal before. > >I've audited all the subscribers to check they didn't look at >mod->state; they seem OK. > >We actually do this in the init-failed path, so this should be OK. We did discuss a similar proposal before: https://lkml.kernel.org/r/87a8m7ko6j.fsf@rustcorp.com.au The complaint back then was that we need to be in the COMING state for strong_try_module_get() to fail. But it will also correctly fail for GOING modules in the module_is_live() check in the subsequent call to try_module_get(), so I believe we are still OK here. Jessica