Skip to main content

settle_subvolume_destination

Function settle_subvolume_destination 

Source
pub fn settle_subvolume_destination(created: &CreatedSubvolume)
Expand description

What: After Git ended, remove the created subvolume if it is still the one this process created and still empty. rmdir deletes an empty subvolume without the user_subvol_rm_allowed mount option. Why: Git leaves an empty destination when it failed before it started to fill it, and a leftover empty subvolume would make the next attempt at the same path look like an accepted empty directory. A destination that holds anything is Git’s result (or its late failure’s) and stays, and so does an object that another process put at the path: the identity recorded at creation must still be the identity of what the name leads to, and the emptiness is read through the descriptor of that object. The last step names the entry in the held parent, and rmdir removes only an empty directory, so a swap in that instant could remove only an empty directory, never data.

In TS you’d write (pseudocode):

async function settleSubvolumeDestination(made: CreatedSubvolume): Promise<void>;