MDL-43390 files: Only lock when locking is not prevented