Re-lock the cache directly after the read. Otherwise the error case would
remove the block from an unlocked cache and the cache->lock would be unlocked twice when the calling function unlocked. It panics in that case anyway, but this should make it continuable and is more correct. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35648 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8d3a8691d4
commit
a282be40e4
3
src/system/kernel/cache/block_cache.cpp
vendored
3
src/system/kernel/cache/block_cache.cpp
vendored
@ -1834,6 +1834,8 @@ retry:
|
||||
|
||||
ssize_t bytesRead = read_pos(cache->fd, blockNumber * blockSize,
|
||||
block->current_data, blockSize);
|
||||
|
||||
mutex_lock(&cache->lock);
|
||||
if (bytesRead < blockSize) {
|
||||
cache->RemoveBlock(block);
|
||||
TB(Error(cache, blockNumber, "read failed", bytesRead));
|
||||
@ -1844,7 +1846,6 @@ retry:
|
||||
}
|
||||
TB(Read(cache, block));
|
||||
|
||||
mutex_lock(&cache->lock);
|
||||
mark_block_unbusy_reading(cache, block);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user