Re: [RFC PATCH 1/2] add pinned flags for kernfs node

From: Greg KH
Date: Wed Sep 08 2021 - 08:35:26 EST


On Wed, Sep 08, 2021 at 08:15:12PM +0800, Yi Tao wrote:
> This patch is preparing for the implementation of cgroup pool. If a
> kernfs node is set to pinned. the data of this node will no longer be
> protected by kernfs internally. When it performs the following actions,
> the area protected by kernfs_rwsem will be protected by the specific
> spinlock:
> 1.rename this node
> 2.remove this node
> 3.create child node
>
> Suggested-by: Shanpei Chen <shanpeic@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Yi Tao <escape@xxxxxxxxxxxxxxxxx>
> ---
> fs/kernfs/dir.c | 74 ++++++++++++++++++++++++++++++++++++--------------
> include/linux/kernfs.h | 14 ++++++++++
> 2 files changed, 68 insertions(+), 20 deletions(-)

Ugh, this is going to get messy fast.

Why are kernfs changes needed for this? kernfs creation is not
necessarily supposed to be "fast", what benchmark needs this type of
change to require the addition of this complexity?

And how are we going to audit things to ensure the "pinning" is working
properly?

thanks,

greg k-h