HDFS-7045. Fix NameNode deadlock when opening file under /.reserved path. Contributed by Yi Liu.
This commit is contained in:
parent
d1dab6cc63
commit
1e684995d7
|
@ -641,6 +641,9 @@ Release 2.6.0 - UNRELEASED
|
|||
HDFS-6621. Hadoop Balancer prematurely exits iterations.
|
||||
(Rafal Wojdyla and Benjamin Bowman via wang)
|
||||
|
||||
HDFS-7045. Fix NameNode deadlock when opening file under /.reserved path.
|
||||
(Yi Liu via wang)
|
||||
|
||||
BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
|
||||
|
||||
HDFS-6387. HDFS CLI admin tool for creating & deleting an
|
||||
|
|
|
@ -1821,8 +1821,8 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|||
checkOperation(OperationCategory.WRITE);
|
||||
writeLock(); // writelock is needed to set accesstime
|
||||
}
|
||||
src = resolvePath(src, pathComponents);
|
||||
try {
|
||||
src = resolvePath(src, pathComponents);
|
||||
if (isReadOp) {
|
||||
checkOperation(OperationCategory.READ);
|
||||
} else {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
package org.apache.hadoop.hdfs;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
@ -80,4 +81,25 @@ public class TestRead {
|
|||
testEOF(cluster, 10000);
|
||||
cluster.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Regression test for HDFS-7045.
|
||||
* If deadlock happen, the test will time out.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(timeout=60000)
|
||||
public void testReadReservedPath() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).
|
||||
numDataNodes(1).format(true).build();
|
||||
try {
|
||||
FileSystem fs = cluster.getFileSystem();
|
||||
fs.open(new Path("/.reserved/.inodes/file"));
|
||||
Assert.fail("Open a non existing file should fail.");
|
||||
} catch (FileNotFoundException e) {
|
||||
// Expected
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue