linux/fs/kernfs
Tejun Heo 783bd07d09 kernfs: Implement kernfs_show()
Currently, kernfs nodes can be created hidden and activated later by calling
kernfs_activate() to allow creation of multiple nodes to succeed or fail as
a unit. This is an one-way one-time-only transition. This patch introduces
kernfs_show() which can toggle visibility dynamically.

As the currently proposed use - toggling the cgroup pressure files - only
requires operating on leaf nodes, for the sake of simplicity, restrict it as
such for now.

Hiding uses the same mechanism as deactivation and likewise guarantees that
there are no in-flight operations on completion. KERNFS_ACTIVATED and
KERNFS_HIDDEN are used to manage the interactions between activations and
show/hide operations. A node is visible iff both activated & !hidden.

Cc: Chengming Zhou <zhouchengming@bytedance.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Tested-by: Chengming Zhou <zhouchengming@bytedance.com>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20220828050440.734579-9-tj@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-01 18:08:44 +02:00
..
dir.c kernfs: Implement kernfs_show() 2022-09-01 18:08:44 +02:00
file.c kernfs: Skip kernfs_drain_open_files() more aggressively 2022-09-01 18:08:44 +02:00
inode.c kernfs: switch global kernfs_rwsem lock to per-fs lock 2021-11-24 13:55:16 +01:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kernfs-internal.h kernfs: Skip kernfs_drain_open_files() more aggressively 2022-09-01 18:08:44 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mount.c kernfs: Replace global kernfs_open_file_mutex with hashed mutexes. 2022-06-27 16:46:15 +02:00
symlink.c kernfs: switch global kernfs_rwsem lock to per-fs lock 2021-11-24 13:55:16 +01:00