HDFS-6463. Merging change r1598437 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1598438 13f79535-47bb-0310-9956-ffa450edef68
HADOOP-9968 and HADOOP-10448. Merging r1570934 and 1598396 from trunk to branch-2.

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