Re: [PATCH v2 3/4] configfs: implement committable items

From: Christoph Hellwig
Date: Tue Dec 01 2020 - 06:27:51 EST


On Mon, Nov 30, 2020 at 05:47:03PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
>
> This implements configfs committable items. We mostly follow the
> documentation except that we extend config_group_ops with uncommit_item()
> callback for reverting the changes made by commit_item().
>
> Each committable group has two sub-directories: pending and live. New
> items can only be created in pending/. Attributes can only be modified
> while the item is in pending/. Once it's ready to be committed, it must
> be moved over to live/ using the rename() system call. This is when the
> commit_item() function will be called.
>
> Implementation-wise: we reuse the default group mechanism to elegantly
> plug the new pseude-groups into configfs. The pending group inherits the
> parent group's operations so that config_items can be seamlesly created
> in it using the callbacks supplied by the user as part of the committable
> group itself.

This looks pretty awkward in the hierachy, but I can't really think
of anything else. One idea would be to require fsync to stage updates,
but that isn't really very well discoverable.