The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Hannes Reinecke <hare@kernel.org>
Cc: Andreas Hindborg <a.hindborg@kernel.org>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	 Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	 Chaitanya Kulkarni <kch@nvidia.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 linux-nvme@lists.infradead.org
Subject: Re: [PATCH RFC v3 01/12] fs/configfs: rework configfs_is_root()
Date: Tue, 23 Jun 2026 05:50:46 -0700	[thread overview]
Message-ID: <ajqASYHIzw3k7Okn@gmail.com> (raw)
In-Reply-To: <20260623-configfs-ns-v3-1-841c100fd5dd@kernel.org>

hello hannes,

On Tue, Jun 23, 2026 at 11:15:46AM +0200, Hannes Reinecke wrote:
> In preparation for making configfs namespace-aware rework
> configfs_is_root() to not rely on static structures but
> rather use the information in the structures themselves.> 

Thanks for the cleanup.  The approach looks fine: CONFIGFS_ROOT is
only ever set on the single static configfs_root dirent.

Nit: "namespace-aware rework configfs_is_root()" reads as if a comma is
missing -- "... namespace-aware, rework configfs_is_root() ...".





> Signed-off-by: Hannes Reinecke <hare@kernel.org>
> ---
>  fs/configfs/configfs_internal.h | 2 +-
>  fs/configfs/mount.c             | 9 +++++++--
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
> index acdeea8e2d69ac9d621e1a42b039719811c31757..6261e1f3ec201a58a5d46b08dfbced8c2a44d82b 100644
> --- a/fs/configfs/configfs_internal.h
> +++ b/fs/configfs/configfs_internal.h
> @@ -63,7 +63,7 @@ extern spinlock_t configfs_dirent_lock;
>  
>  extern struct kmem_cache *configfs_dir_cachep;
>  
> -extern int configfs_is_root(struct config_item *item);
> +extern bool configfs_is_root(struct config_item *item);
>  
>  extern struct inode * configfs_new_inode(umode_t mode, struct configfs_dirent *, struct super_block *);
>  extern struct inode *configfs_create(struct dentry *, umode_t mode);
> diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
> index 4929f343118946eaa55a539db4192e9c6621a8dc..88da7b428e52f2f4ab139ad3907101f685d617b1 100644
> --- a/fs/configfs/mount.c
> +++ b/fs/configfs/mount.c
> @@ -47,9 +47,14 @@ static struct config_group configfs_root_group = {
>  	},
>  };
>  
> -int configfs_is_root(struct config_item *item)
> +bool configfs_is_root(struct config_item *item)
>  {
> -	return item == &configfs_root_group.cg_item;
> +	struct configfs_dirent *sd;
> +
> +	if (!item->ci_dentry)
> +		return false;
> +	sd = item->ci_dentry->d_fsdata;
> +	return !!(sd->s_type & CONFIGFS_ROOT);

The old helper was a pure pointer comparison and never touched item, so it
tolerated a NULL or not-yet-attached item.  The new one dereferences
it (item). I suppose that item is never being called as NULL?!

Thanks
--breno

  reply	other threads:[~2026-06-23 12:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  9:15 [PATCH RFC v3 00/12] namespace-aware configfs Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 01/12] fs/configfs: rework configfs_is_root() Hannes Reinecke
2026-06-23 12:50   ` Breno Leitao [this message]
2026-06-23  9:15 ` [PATCH RFC v3 02/12] fs/configfs: dynamically allocate super_info Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 03/12] fs/configfs: separate out configfs_{link,unlink}_root() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 04/12] fs/configfs: add superblock as attribute to configfs_pin_fs() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 05/12] fs/configfs: add 'fill_subsystem' and 'clear_subsystem' callbacks Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 06/12] fs/namespace: implement mnt_clone_direct() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 07/12] fs/configfs: switch to get_tree_keyed() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 08/12] fs/configfs: open-code simple_pin_fs() Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 09/12] nvmet: make discovery subsystem dynamic Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 10/12] nvmet: per net-namespace port list Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 11/12] nvmet: make configfs setup namespace aware Hannes Reinecke
2026-06-23  9:15 ` [PATCH RFC v3 12/12] nvmet: enable transports for net namespaces Hannes Reinecke
2026-06-23 14:37 ` [syzbot ci] Re: namespace-aware configfs syzbot ci

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=ajqASYHIzw3k7Okn@gmail.com \
    --to=leitao@debian.org \
    --cc=a.hindborg@kernel.org \
    --cc=brauner@kernel.org \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=kch@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=viro@zeniv.linux.org.uk \
    /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