snapuserd: fix the race condition with read_ahead_buffer_map_
There are cases where concurrent access to read-ahead buffer map are
needed by readahead thread and ReadWorker thread. ReadWorker may access
the read-ahead buffer to satisfy read request for the block which is
being merged. This access was not protected by buffer_lock_.
This patch adds the necessary locking around read_ahead_buffer_map_.
As GetRABuffer() also needs MergeGroupState m_lock, we maintain the
lock order buffer_lock_ -> m_lock to avoid the lock ordering violation
and potential deadlock.
Bug: 436974300
Test: th, manual OTA on CF
Change-Id: Ie04664158d79de9f8118942f9e0da05981991181
Signed-off-by:
Sandeep Dhavale <dhavale@google.com>
Loading
Please register or sign in to comment