浏览代码

HDFS-7660. BlockReceiver#close() might be called multiple times, which causes the fsvolume reference being released incorrectly. (Lei Xu via yliu)

yliu 10 年之前
父节点
当前提交
5f124efb3e

+ 4 - 0
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

+ 2 - 1
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 @@ class BlockReceiver implements Closeable {
     }
     if (replicaHandler != null) {
       IOUtils.cleanup(null, replicaHandler);
+      replicaHandler = null;
     }
     if (measuredFlushTime) {
       datanode.metrics.addFlushNanos(flushTotalNanos);