[
https://issues.apache.org/jira/browse/HDFS-6848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14096254#comment-14096254
]
Xiaoyu Yao commented on HDFS-6848:
----------------------------------
Note: the only caller of DataStorage#format() is the synchronized method
addStorageLocations. So we should be fine without any changes.
If this going to be called by other non-synchronized method in future, it is
better to call the synchronized method setDatanodeUuid() instead of the direct
assignment as Ted reported above in DataStorage#format().
{code}
private synchronized void addStorageLocations(DataNode datanode,...)
{
format(sd, nsInfo, datanode.getDatanodeUuid());
}
{code}
> Lack of synchronization on access to datanodeUuid in DataStorage#format()
> --------------------------------------------------------------------------
>
> Key: HDFS-6848
> URL: https://issues.apache.org/jira/browse/HDFS-6848
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Ted Yu
> Priority: Minor
>
> {code}
> this.datanodeUuid = datanodeUuid;
> {code}
> The above assignment should be done holding lock "DataStorage.this" - as is
> done in two other places.
--
This message was sent by Atlassian JIRA
(v6.2#6252)