All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] New ioctl to query deleted subvolumes
@ 2024-10-09 18:03 David Sterba
  2024-10-10 12:29 ` Yuwei Han
  0 siblings, 1 reply; 7+ messages in thread
From: David Sterba @ 2024-10-09 18:03 UTC (permalink / raw)
  To: linux-btrfs

Hi,

I'd like some user feedback on a new ioctl that should handle several use cases
around subvolume deletion. Currently it's implemented on top of the privileged
SEARCH_TREE ioctl, it's not possible to do that with libbtrfsutil or
unprivileged ioctls.

The use cases:

  1) wait for a specific id until it's cleaned (blocking, not blocking)

This is what 'btrfs subvol sync id' does. In the non-blocking mode it checks if
a subvolume is in the queue for deletion.

  2) wait for all currently queued subvolumes (blocking)

Same as 'btrfs subvol sync' without any id.

  3) read id of the currently cleaned subvolume (not blocking)

Allow to implement sync purely in user space.

  4) read id of the last in the queue (not blocking)

As the subvolumes are added to the list in the order of deletion, reading the
last one is kind of a checkpoint. More subvolumes can be added to the queue in
the meanwhile so this adds some flexibility to applications.

  5) count the number of queued subvolumes (not blocking)

This is for convenience and progress reports.


There are some questions and potential problems stemming from the general
availability of the ioctl:

- the operations will need to take locks and/or lookup the subvolumes in the
  data structures, so it could be abused to overload the locks, but there are
  more such ways how to do that so I'm not sure what to do here

- deleted subvolume loses it's connection to path in directory hierarchy, so
  querying an id does not tell us if the user was allowed to see the subvolume

- the blocking operations can take a timeout parameter (seconds), this is for
  convenience, otherwise a simple "while (ioctl) sleep(1)" will always work


My questions:

- Are there other use cases that are missing from the list?

- Are there use cases that should not be implemented? E.g. not worth the
  trouble or not really useful.

I have a prototype for 1 and 2, the others would be easy to implement
but the number of cases affects the ioctl design (simple id vs modes).

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-12  1:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 18:03 [RFC] New ioctl to query deleted subvolumes David Sterba
2024-10-10 12:29 ` Yuwei Han
2024-10-10 17:08   ` David Sterba
2024-10-11 12:06     ` Yuwei Han
2024-10-11 12:20       ` Roman Mamedov
2024-10-12  1:45         ` Yuwei Han
2024-10-11 15:48       ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.