From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B14AEC4361A for ; Thu, 3 Dec 2020 18:32:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5046B208A9 for ; Thu, 3 Dec 2020 18:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729549AbgLCSb7 (ORCPT ); Thu, 3 Dec 2020 13:31:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:56160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727599AbgLCSb6 (ORCPT ); Thu, 3 Dec 2020 13:31:58 -0500 Date: Thu, 3 Dec 2020 19:32:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1607020272; bh=ooOaTQVTWODxjzPcn11n7fZSJANiXkVMAWaIlK7pTZY=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=zxRgUcXk6SIi5v94rKZmgeeoN4ml7+qC96MjLr/CW22p/Jua1cK3pQI3Ye3J37zVe 0SG0FFw/ZAGT1zFVb91ZnRAmDht/V0eMirkKUurk+bYTHtKl96pzvXL3igbqJnHtHm qDQuw8sqsIKuZ3J9tIU/7vPAlGXLxajMy5uaojf0= From: Greg KH To: Jessica Yu Cc: linux-kernel@vger.kernel.org, systemd-devel@lists.freedesktop.org, Franck Bui , Nicolas Morey-Chaisemartin Subject: Re: [systemd-devel] [PATCH RFC 1/1] module: delay kobject uevent until after module init call Message-ID: References: <20201203135124.16695-1-jeyu@kernel.org> <20201203135124.16695-2-jeyu@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201203135124.16695-2-jeyu@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 03, 2020 at 02:51:24PM +0100, Jessica Yu wrote: > Apparently there has been a longstanding race between udev/systemd and > the module loader. Currently, the module loader sends a uevent right > after sysfs initialization, but before the module calls its init > function. However, some udev rules expect that the module has > initialized already upon receiving the uevent. > > This race has been triggered recently (see link in references) in some > systemd mount unit files. For instance, the configfs module creates the > /sys/kernel/config mount point in its init function, however the module > loader issues the uevent before this happens. sys-kernel-config.mount > expects to be able to mount /sys/kernel/config upon receipt of the > module loading uevent, but if the configfs module has not called its > init function yet, then this directory will not exist and the mount unit > fails. A similar situation exists for sys-fs-fuse-connections.mount, as > the fuse sysfs mount point is created during the fuse module's init > function. If udev is faster than module initialization then the mount > unit would fail in a similar fashion. > > To fix this race, delay the module KOBJ_ADD uevent until after the > module has finished calling its init routine. > > References: https://github.com/systemd/systemd/issues/17586 > Signed-off-by: Jessica Yu Nice fix: Reviewed-by: Greg Kroah-Hartman