The industry bought companies for too much money and made a bunch of bad loans. Now they’re scrambling to avoid the reckoning.