Merge -r 1428386:1428387 from trunk to branch-2. Fixes: YARN-300. After YARN-271, fair scheduler can infinite loop and not schedule any application. Contributed by Sandy Ryza.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1428393 13f79535-47bb-0310-9956-ffa450edef68