From 5f124efb3e090f96f217bee22f3c8897f9772f14 Mon Sep 17 00:00:00 2001 From: yliu Date: Fri, 23 Jan 2015 02:37:44 +0800 Subject: [PATCH] HDFS-7660. BlockReceiver#close() might be called multiple times, which causes the fsvolume reference being released incorrectly. (Lei Xu via yliu) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 4 ++++ .../org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 74eb160695..9176ec7ecc 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -768,6 +768,10 @@ Release 2.7.0 - UNRELEASED HDFS-3519. Checkpoint upload may interfere with a concurrent saveNamespace. (Ming Ma via cnauroth) + HDFS-7660. BlockReceiver#close() might be called multiple times, which + causes the fsvolume reference being released incorrectly. (Lei Xu via + yliu) + Release 2.6.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java index 12041a60ae..3d37df5746 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java @@ -123,7 +123,7 @@ class BlockReceiver implements Closeable { private boolean syncOnClose; private long restartBudget; /** the reference of the volume where the block receiver writes to */ - private final ReplicaHandler replicaHandler; + private ReplicaHandler replicaHandler; /** * for replaceBlock response @@ -334,6 +334,7 @@ public void close() throws IOException { } if (replicaHandler != null) { IOUtils.cleanup(null, replicaHandler); + replicaHandler = null; } if (measuredFlushTime) { datanode.metrics.addFlushNanos(flushTotalNanos);