Reapply commit 112702 which was speculatively reverted by echristo.