Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755241AbbBSA5k (ORCPT ); Wed, 18 Feb 2015 19:57:40 -0500 Received: from ozlabs.org ([103.22.144.67]:35299 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755215AbbBSA5j (ORCPT ); Wed, 18 Feb 2015 19:57:39 -0500 From: Rusty Russell To: Lucas De Marchi Cc: Harish Jenny K N , linux-modules , lkml , "greg KH" Subject: Re: [PATCH] libkmod-module: Remove directory existence check for KMOD_MODULE_BUILTIN In-Reply-To: References: <1424177796-17923-1-git-send-email-harish_kandiga@mentor.com> <874mqjuaky.fsf@rustcorp.com.au> User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Thu, 19 Feb 2015 09:10:12 +1030 Message-ID: <87vbiysv1v.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: 1239 Lines: 29 Lucas De Marchi writes: > On Wed, Feb 18, 2015 at 2:07 AM, Rusty Russell wrote: > Yeah, I just thought (an wanted that) the attributes were being > created first and then hooked up in the sysfs tree under > /sys/module/. I.e. if the directory exists and there's no > initstate this is because it's a builtin module. I don't want to > wait/sleep on the file to appear because users of > kmod_module_get_initstate() may not tolerate this behavior. > > Looking up at the old module-init-tools, it used an ugly loop with > usleep() before trying to read the file again :-/ > > Can we change kernel side guaranteeing the initstate file appears > together with the directory? Greg? The core problem is that kmod looks for /sys/module//initstate; if it's not there, it assumes a builtin module. However, this is racy when a module is being inserted. Is there a way to create this sysfs file and dir atomically? Thanks, Rusty. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/