Feature #44455

Updated by Patrick Donnelly about 1 year ago

This is a fairly common operation [1] and there's no particular reason we can't support it. The PurgeQueue (I think) is already well architected enough to support this with some modification. In particular, it needs to permit Namely, an unlinked directory to may have numerous children.

I see two immediate use-cases:

* The pybind/mgr/volumes plugin currently has an asynchronous unlink module that cleans up deleted volumes. It'd be much simpler to just tell the MDS to unlink the directory tree.
* cephfs-shell can provide a command which may be used out-of-band to unlink some subtree (thinking HPC)

Keep in mind we can relax some POSIX consistency requirements: the link counts on all the descendants may not change. Logically, this is just renaming the directory to an internal Trash directory that's slowly purged by the MDS. One moderate challenge that needs addressed is revoking any capabilities to asynchronously create files by clients in the subtree. Likewise, the MDS shouldn't create any files in the unlinked subtree via a create RPC.

[1] For example, HDFS has long had a recursive unlink command.