Global grain stocks are heading for a 15-year high as the largest ever U.S. corn harvest enters its final stages, but the risk of food shortages persists as demand for meat and biofuel keeps rising.

Drought in major grain-producing countries in both 2007/08 and 2010/11 led to a sharp rise in food prices, plunging millions more people into poverty, sparking riots and playing a role in the overthrow of some governments.

Cereal stocks have since been rebuilt and look set to climb to the highest level since the 1999/2000 season, according to the United Nations Food and Agriculture Organization (FAO).

Global corn stocks are forecast by the U.S. Department of Agriculture to reach 192 million tonnes by the end of the current season, not far from an all-time high of 205 million set 28 years earlier.

But analysts warned that stocks could quickly be eaten up in the event of poor harvests.

"I think demand growth is the big difference between this decade versus what happened in the nineties. What this means is you have less margin for error," said Brett Cooper, senior manager at FCStone Australia.

"We are probably in a rebuilding phase still, but the type of comfort you got in the nineties is not evident yet."

When the earlier record was set in 1987, it was enough corn to feed the world for 168 days. Current stocks would last only around 72 days, because consumption has more than doubled since then.

A large share of the harvest now goes to produce ethanol, particularly in the United States. Demand has also risen for corn to feed livestock as consumption of meat has increased in emerging nations such as China.

The ratio of corn stocks to global annual consumption, a measure of how reserves would cover shortages in the event of a crop disaster, is around 20 percent.

"We can consider that a stocks-to-use ratio of around 30 to 35 percent is about the level needed from now on to feed the world population and maintain reserves," said Thierry Pouch, head of research at farming advisory body APCA in France.

"Even if it is recovering, the stocks-to-use level for corn is at a very low level."

LOCKED UP STOCKS

Rich Nelson, chief strategist for U.S.-based consultancy Allendale Inc., noted that corn seedings have been reduced in South America and that the U.S. corn area is likely to be smaller next spring.

"I wouldn't call the global corn supply a glut. I would say it's a large supply that will be slightly moderated into 2016," he said.

Adding to concerns about the security of food supplies is the location of global stocks, which are moving from exporters to major importers such as China.

"You have to look at where stocks are available. You can encounter a notion of food sovereignty in countries like India and China that lock up their stocks, apart from the problem of what is the actual state of their stocks," Pouch said.

The USDA estimates that China will hold more than 40 percent of global corn stocks at the end of the current season, up from around 28 percent when global stocks were at record levels in 1987.

Analysts said stocks held in China would be less accessible to the world market in the event of a crisis than those held in a major exporting country such as the United States.

Global wheat stocks are slightly more comfortable, with a projected stocks-to-use ratio of 27 percent at the end of the current season, based on USDA data, but the location of those supplies is also a concern.

"For wheat, we will have a very good supply on the world market, and we also see some growth in inventory levels with the major exporters. However, some of the growth in inventory levels worldwide will come from China, which is unlikely to export," F.O. Licht analyst Claus Keller said.

At the least, however, two consecutive bumper global grain harvests should provide temporary respite from the threat of food crises.

"Thanks to large inventories, grain markets are likely to remain stable this season, with international prices remaining under downward pressure well into next year," said Abdolreza Abbassian, senior economist at the FAO.

"In fact, above-average stocks held in major exporting countries, as expected for this season, could also help as a buffer against any major production shortfall in 2015."