From e06ae2d5673935c01b5061bd1e7c4835bbc0b680 Mon Sep 17 00:00:00 2001 From: Jing Zhao Date: Mon, 13 Jan 2014 18:37:56 +0000 Subject: [PATCH] HDFS-5710. FSDirectory#getFullPathName should check inodes against null. Contributed by Uma Maheswara Rao G. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1557803 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index af95486f1e8..ecabd703959 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -746,6 +746,9 @@ Release 2.4.0 - UNRELEASED HDFS-5747. Fix NPEs in BlockManager. (Arpit Agarwal) + HDFS-5710. FSDirectory#getFullPathName should check inodes against null. + (Uma Maheswara Rao G via jing9) + BREAKDOWN OF HDFS-2832 SUBTASKS AND RELATED JIRAS HDFS-4985. Add storage type to the protocol and expose it in block report diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java index a9f17fa3bd2..011bcf26ba4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java @@ -1842,7 +1842,8 @@ public class FSDirectory implements Closeable { /** Return the full path name of the specified inode */ static String getFullPathName(INode inode) { INode[] inodes = getFullPathINodes(inode); - return getFullPathName(inodes, inodes.length - 1); + // inodes can be null only when its called without holding lock + return inodes == null ? "" : getFullPathName(inodes, inodes.length - 1); } /**