ANDROID: Incremental fs: make remount log buffer change atomic
Read log buffer can have multiple threads doing any of these operations simultaneously: - Polling for changes - Reading log records - Adding new log records - Updating log buffer size, or enabling/disabling it completely As we don't control the userspace, and it turns out that they all currently originate from different processes, code needs to be safe against parallel access to a read buffer and a request for reallocating it. This CL add an r/w spinlock to protect the buffer and its size. Each remount takes the write lock, while everything else takes a read lock. Remount makes sure it doesn't take too long by preallocating and precalculating all updates, while other operations don't care much about their critical section size - they all can still run together. Bug: 152633648 Test: manual remount + reading Signed-off-by:Yurii Zubrytskyi <zyy@google.com> Signed-off-by:
Paul Lawrence <paullawrence@google.com> Change-Id: I7271b4cb89f1ae2cbee6e5b073758f344c4ba66a
Loading
Please register or sign in to comment