platform_system_core/fs_mgr/libdm
David Anderson 4f9d1b15b4 libdm: Fix race conditions in LoopControl::Attach.
This fixes two race conditions in LoopControl::Attach(). The first is
that after LOOP_CTL_GET_FREE, the path is not be available until it has
been processed by ueventd. This can be fixed by adding a timeout
parameter and a call to WaitForFile().

Second, it is possible (albeit unlikely), given that loop devices are
now being used more aggressively, that two processes race when
attempting LOOP_SET_FD. In this case, one process will win, and the
other will fail with EBUSY. We can handle this case by retrying the
operation while respecting the same timeout parameter.

Bug: 135771280
Test: libdm_test gtest
Change-Id: Icf9facc3ca28fdb6ff5c78612d3dc183fa47b1f3
2019-07-11 15:39:53 -07:00
..
include/libdm libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00
Android.bp libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00
Android.mk Allow makefiles to be parsed in a trimmed down manifest. 2019-03-25 09:14:33 +00:00
AndroidTest.xml Make VTS run libdm_test 2019-03-22 15:11:49 -07:00
dm.cpp libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00
dm_table.cpp libdm: Add DmTargetVerity and use it in fs_mgr_avb. 2018-06-25 17:56:12 -07:00
dm_target.cpp libdm: Add dm-crypt and dm-default-key support to libdm. 2019-05-09 15:14:13 -07:00
dm_test.cpp libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00
loop_control.cpp libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00
loop_control_test.cpp libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00
test_util.cpp libdm: Add unit tests for dm-linear. 2018-06-25 12:56:14 -07:00
test_util.h libdm: Add unit tests for dm-linear. 2018-06-25 12:56:14 -07:00
utility.cpp libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00
utility.h libdm: Fix race conditions in LoopControl::Attach. 2019-07-11 15:39:53 -07:00