[
https://issues.apache.org/jira/browse/HDFS-7495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ted Yu updated HDFS-7495:
-------------------------
Attachment: hdfs-7495-001.patch
Looking a bit closer, updatePosition is not modified within getBlockAt().
Its value is only true when called from blockSeekTo() which already obtains
lock on this.
Here is proposed patch which makes this part of code more readable.
> Lock inversion in DFSInputStream#getBlockAt()
> ---------------------------------------------
>
> Key: HDFS-7495
> URL: https://issues.apache.org/jira/browse/HDFS-7495
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Ted Yu
> Priority: Minor
> Attachments: hdfs-7495-001.patch
>
>
> There're two locks: one on DFSInputStream.this , one on
> DFSInputStream.infoLock
> Normally lock is obtained on infoLock, then on DFSInputStream.infoLock
> However, such order is not observed in DFSInputStream#getBlockAt() :
> {code}
> synchronized(infoLock) {
> ...
> if (updatePosition) {
> // synchronized not strictly needed, since we only get here
> // from synchronized caller methods
> synchronized(this) {
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)