HDFS-7498. Simplify the logic in INodesInPath. Contributed by Jing Zhao.