All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeel.butt@linux.dev>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Tejun Heo <tj@kernel.org>,
	Christian Brauner <christian@brauner.io>
Cc: Meta kernel team <kernel-team@meta.com>,
	 linux-kselftest@vger.kernel.org, driver-core@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: cover kernfs dentry revalidation
Date: Tue, 1 Sep 2026 07:26:21 -0700	[thread overview]
Message-ID: <apbgQnHeMKDyVHPg@linux.dev> (raw)
In-Reply-To: <20260829022825.407836-1-shakeel.butt@linux.dev>

On Fri, Aug 28, 2026 at 07:28:25PM -0700, Shakeel Butt wrote:
> kernfs_test only exercised two xattr calls, so nothing covered the part
> of kernfs most exposed to userspace: the dentry cache.
> 
> kernfs nodes appear and disappear from kernel contexts with no VFS
> operation driving them, and removal cannot reliably unhash the cached
> dentries, so ->d_revalidate() is the correctness backstop. It had no
> test at all.
> 
> Add tests that drive kernfs from kernel context rather than through VFS
> create/unlink:
> 
>  - writing cgroup.subtree_control makes the kernel add and remove files
>    in every child cgroup, exercising both the negative-dentry revision
>    check and the deactivation check,
>  - renaming a network interface renames the sysfs node underneath an
>    already cached dentry,
>  - sysfs in a fresh network namespace must show only that namespace's
>    interfaces, covering the KERNFS_NS tagging paths,
>  - lookup hammered against concurrent mkdir/rmdir must only ever see
>    success or an errno meaning "it went away",
>  - removal-while-open, readdir duplicate detection and a
>    seekdir()/telldir() round trip over kernfs_dir_pos()'s hash cookie.
> 
> Also the other direction: walking already cached dentries must not
> invalidate them. That is not merely a lost optimisation --
> d_invalidate() calls detach_mounts(), so a revalidation that wrongly
> fails silently tears down any mount underneath the directory.
> 
> Both filesystems are needed: cgroup2 has no ->rename and is not
> namespace tagged, and sysfs cannot be mounted with a controllable set of
> children. The config fragment keeps a kernel built via kselftest-merge
> from reporting a pass while running almost nothing.
> 
> Verified the suite reacts to a broken backstop rather than passing:
> stubbing kernfs_dir_changed() to return false turns 8 of the 11 tests
> red.
> 
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>

Sashiko raised couple of issues, so I will address those and send v2.

      reply	other threads:[~2026-09-01 14:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29  2:28 [PATCH] selftests: cover kernfs dentry revalidation Shakeel Butt
2026-09-01 14:26 ` Shakeel Butt [this message]

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=apbgQnHeMKDyVHPg@linux.dev \
    --to=shakeel.butt@linux.dev \
    --cc=christian@brauner.io \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=tj@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.