diag: Protect shared resources while mask updates