All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yohei Kojima <yk@y-koj.net>
To: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	driver-core@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] debugfs: don't warn about uninitialized debugfs for an error parent
Date: Fri, 4 Sep 2026 01:00:54 +0900	[thread overview]
Message-ID: <apmZtlPdQ4L0Defz@desktop.y-koj.net> (raw)
In-Reply-To: <20260903115135.63210-1-mikhail.v.gavrilov@gmail.com>

On Thu, Sep 03, 2026 at 04:51:35PM +0500, Mikhail Gavrilov wrote:
> Since commit c3a280ff728a
> ("debugfs: warn if file creation failed due to uninitialized debugfs")
> every boot with CONFIG_REF_TRACKER=y and CONFIG_DEBUG_FS=y prints two
> errors before the root filesystem is mounted:
> 
>   debugfs: Unable to create file 'net_refcnt@(____ptrval____)',
>     debugfs is not initialized yet
>   debugfs: Unable to create file 'net_notrefcnt@(____ptrval____)',
>     debugfs is not initialized yet

Ugh... I should've noticed this...

> Move the IS_ERR(parent) check above the debugfs_initialized() test.  A
> caller passing an error parent is propagating an earlier failure, which is
> the pattern debugfs documents and which the warning is not aimed at.  A
> caller passing a valid or NULL parent too early - the case the warning was
> added for - still gets it.
> 
> One behaviour change: an early caller with an error parent now gets
> PTR_ERR(parent) back instead of -ENOENT.  All callers of these interfaces
> are documented to ignore the return value.

The new behavior looks better than the old one as it used to ignore
parent's errno and just returned ERR_PTR(-ENOENT).

> 
> Fixes: c3a280ff728a ("debugfs: warn if file creation failed due to uninitialized debugfs")
> Link: https://lore.kernel.org/all/6d1dc775f7d5e754d734907514534054f682bac5.1781171918.git.yk@y-koj.net/
> Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>

I tested this patch on x86_64 (Intel Core i7-14700K), Gentoo, v7.3-rc1
(940de590b839), CONFIG_REF_TRACKER=y, CONFIG_DEBUG_FS=y, with KASAN and
lockdep enabled.

  $ diff -u before_patch after_patch 
  --- before_patch        2026-09-03 23:46:02.856774818 +0900
  +++ after_patch 2026-09-03 23:46:09.990259686 +0900
  @@ -1,8 +1,6 @@
   Yama: becoming mindful.
   SELinux:  Initializing.
  -debugfs: Unable to create file 'net_refcnt@(____ptrval____)', debugfs is not initialized yet
   stackdepot: allocating hash table of 131072 entries via kvcalloc
   stackdepot: allocating space for 8192 stack pools via kvcalloc
  -debugfs: Unable to create file 'net_notrefcnt@(____ptrval____)', debugfs is not initialized yet
   Mount-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
   Mountpoint-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)

Tested-by: Yohei Kojima <yk@y-koj.net>

Thank you for reporting and fixing this during rc!

Yohei


  reply	other threads:[~2026-09-03 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 11:51 [PATCH] debugfs: don't warn about uninitialized debugfs for an error parent Mikhail Gavrilov
2026-09-03 16:00 ` Yohei Kojima [this message]
2026-09-11 21:20 ` Danilo Krummrich

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=apmZtlPdQ4L0Defz@desktop.y-koj.net \
    --to=yk@y-koj.net \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=rafael@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.