cleanupOrphaned can be called between
MigrationSourceManager::commitDonateChunk. The _uncommittedMetadata variable is create and saved in MigrationSourceManager::enterCriticalSection, but the actual commit doesn't happen until MigrationSourceManager::commitDonateChunk is finished. cleanupOrphaned can sneak in between and use the _uncommittedMetadata saved state to decide the not yet committed chunk – which can still fail to be committed, thus we end up keeping the chunk data – is gone and then delete all the data.
The master fix is going in as a result of
SERVER-22659 – the commit to remove the _uncommittedMetadata variable. It needs to be backported, and modified if necessary.