[ 
https://issues.apache.org/jira/browse/HDFS-9054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

zhaoyunjiong updated HDFS-9054:
-------------------------------
    Affects Version/s: 2.7.0
               Status: Patch Available  (was: Open)

> 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
>    Affects Versions: 2.7.0
>            Reporter: zhaoyunjiong
>            Assignee: zhaoyunjiong
>            Priority: Minor
>         Attachments: HDFS-9054.patch
>
>
> 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)

Reply via email to