Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Namjae Jeon <linkinjeon@kernel.org>,
	Steve French <smfrench@gmail.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Tom Talpey <tom@talpey.com>,
	linux-cifs@vger.kernel.org, Rosen Penev <rosenp@gmail.com>
Subject: Re: [PATCH v2] RFC: ksmbd: Create module_kobject if builtin
Date: Fri, 24 Oct 2025 07:08:01 +0200	[thread overview]
Message-ID: <2025102441-calculate-accustom-2023@gregkh> (raw)
In-Reply-To: <20251024-ksmbd-sysfs-module-v2-1-acba8159dbe5@linaro.org>

On Fri, Oct 24, 2025 at 12:49:44AM +0200, Linus Walleij wrote:
> Adding a call to lookup_or_create_module_kobject() to ksmbd
> makes /sys/modules/ksmbd appear even when ksmbd is compiled
> into the kernel.

Ick, no, please do not.  Otherwise you will see this pop up in all
drivers/modules for the same "reason".

> This is nice when you boot a custom kernel on OpenWrt because
> the startup script does things such as:
> 
> [ ! -e /sys/module/ksmbd ] && modprobe ksmbd 2> /dev/null
> if [ ! -e /sys/module/ksmbd ]; then
>     logger -p daemon.error -t 'ksmbd' "modprobe of ksmbd "
>     "module failed, can\'t start ksmbd!"
>      exit 1
> fi
> 
> which makes the script not work with a compiled-in ksmbd.

Please fix the start up script to not do this.  Don't work around broken
userspace by changing the kernel.

> Since I actually turn off modules and compile all my modules
> into the kernel, I can't change the script to just check
> cat /lib/modules/$(uname -r)/modules.builtin | grep ksmbd
> either: no /lib/modules directory.

Then do something else to determine if ksmbd is in the running kernel,
don't rely on a modules sysfs file like that.

> An option would be to change the script to proceed and
> just assume the module is compiled in but it feels wrong.

Agreed, surely there is some other way to "know" if that kernel feature
is present or not, right?  Mount a filesystem?  Something else?

> If this approach is acceptable I am happy to generalize this
> to something that any module that wants a /sys/modules/foo
> file can use to get just that.

No, please do not do that.  Just fix userspace.

thanks,

greg k-h

  reply	other threads:[~2025-10-24  5:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 22:49 [PATCH v2] RFC: ksmbd: Create module_kobject if builtin Linus Walleij
2025-10-24  5:08 ` Greg Kroah-Hartman [this message]
2025-10-24  6:05   ` Linus Walleij
2025-10-24  6:37     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2025102441-calculate-accustom-2023@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linkinjeon@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=rosenp@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox