svn merge -c 1517989 merging from trunk to branch-2 to fix HDFS-5132.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1517990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2013-08-27 21:06:12 +00:00
parent 5b01125048
commit fe800d3b88
2 changed files with 18 additions and 4 deletions

View File

@ -169,6 +169,9 @@ Release 2.1.1-beta - UNRELEASED
HDFS-5124. DelegationTokenSecretManager#retrievePassword can cause deadlock
in NameNode. (Daryn Sharp via jing9)
HDFS-5132. Deadlock in NameNode between SafeModeMonitor#run and
DatanodeManager#handleHeartbeat. (kihwal)
Release 2.1.0-beta - 2013-08-22
INCOMPATIBLE CHANGES

View File

@ -4781,7 +4781,21 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
*/
@Override
public void run() {
while (fsRunning && (safeMode != null && !safeMode.canLeave())) {
while (fsRunning) {
writeLock();
try {
if (safeMode == null) { // Not in safe mode.
break;
}
if (safeMode.canLeave()) {
// Leave safe mode.
safeMode.leave();
break;
}
} finally {
writeUnlock();
}
try {
Thread.sleep(recheckInterval);
} catch (InterruptedException ie) {
@ -4790,9 +4804,6 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
}
if (!fsRunning) {
LOG.info("NameNode is being shutdown, exit SafeModeMonitor thread");
} else {
// leave safe mode and stop the monitor
leaveSafeMode();
}
smmthread = null;
}