zhaoyunjiong created HDFS-9054: ---------------------------------- Summary: Race condition on yieldCount in FSDirectory.java Key: HDFS-9054 URL: https://issues.apache.org/jira/browse/HDFS-9054 Project: Hadoop HDFS Issue Type: Bug Components: namenode Reporter: zhaoyunjiong Assignee: zhaoyunjiong Priority: Minor
getContentSummaryInt only held read lock, and it called fsd.addYieldCount which may cause race condition: {code} private static ContentSummary getContentSummaryInt(FSDirectory fsd, INodesInPath iip) throws IOException { fsd.readLock(); try { INode targetNode = iip.getLastINode(); if (targetNode == null) { throw new FileNotFoundException("File does not exist: " + iip.getPath()); } else { // Make it relinquish locks everytime contentCountLimit entries are // processed. 0 means disabled. I.e. blocking for the entire duration. ContentSummaryComputationContext cscc = new ContentSummaryComputationContext(fsd, fsd.getFSNamesystem(), fsd.getContentCountLimit(), fsd.getContentSleepMicroSec()); ContentSummary cs = targetNode.computeAndConvertContentSummary(cscc); fsd.addYieldCount(cscc.getYieldCount()); return cs; } } finally { fsd.readUnlock(); } } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)