public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Christoph Hellwig <hch@lst.de>
Cc: Joel Becker <jlbec@evilplan.org>,
	Daniel Baluta <daniel.baluta@intel.com>,
	Kishon Vijay Abraham I <kishon@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel@vger.kernel.org
Subject: [RFC] configfs_{un,}register_group() semantics
Date: Sun, 12 May 2024 05:30:12 +0100	[thread overview]
Message-ID: <20240512043012.GG2118490@ZenIV> (raw)

	Folks, could you confirm if the following is correct?

1. configfs_unregister_group() callers are supposed to prevent
having it called when some items/groups had been created under it.
The original one (in iio) *does* prevent that (the call chains come
through the module_exit() of modules pinned by ->make_group() for
the added subdirectory), but I don't see that documented anywhere and
AFAICS at least in one case (drivers/pci/endpoint/pci-ep-cfs.c) that is
not guaranteed.  The same goes for symlinks created in or to those.

2. rmdir on directory added by configfs_register_group() is supposed to
fail (is it even supposed to be used inside the stuff created by mkdir?
Original use was inside a subsystem, AFAICS).

3. rmdir that would've taken out the parent group is supposed to take
the added one out (again, are they even supposed to be used inside the
stuff created by mkdir?)

4. one is *NOT* supposed to use have ->make_group() schedule creation of
subdirectories via configfs_register_group(); configfs_add_default_group()
ought to be used instead.

drivers/pci/endpoint/pci-ep-cfs.c:pci_epf_make() has this:
        INIT_DELAYED_WORK(&epf_group->cfs_work, pci_epf_cfs_work);
        queue_delayed_work(system_wq, &epf_group->cfs_work,
                           msecs_to_jiffies(1));

        return &epf_group->group;

with pci_epf_cfs_work() allocating several config_group and calling
configfs_register_group() to link those in.  I really doubt that this
kind of "let's hope that configfs_mkdir() will get through directory
creation in less than 1ms after ->make_group() returns" is the way it
is supposed to be done; at a guess, configfs_add_default_group()
should've been used (synchronously), but I might be missing something
subtle here.

Comments?

             reply	other threads:[~2024-05-12  4:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-12  4:30 Al Viro [this message]
2024-05-12  4:35 ` [RFC] configfs_{un,}register_group() semantics Al Viro
2024-05-15 19:07   ` Joel Becker

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=20240512043012.GG2118490@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=bhelgaas@google.com \
    --cc=daniel.baluta@intel.com \
    --cc=hch@lst.de \
    --cc=jlbec@evilplan.org \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox