cellSysCache: Global hdd1 lock

Take advantage of recursive locking.
This commit is contained in:
Eladash 2020-09-15 22:20:51 +03:00 committed by Ivan
commit 183aa31319

View file

@ -79,8 +79,6 @@ struct syscache_info
// Poison opened files in /dev_hdd1 to return CELL_EIO on access // Poison opened files in /dev_hdd1 to return CELL_EIO on access
if (remove_root) if (remove_root)
{ {
std::lock_guard lock(g_mp_sys_dev_hdd1.mutex);
idm::select<lv2_fs_object, lv2_file>([](u32 id, lv2_file& file) idm::select<lv2_fs_object, lv2_file>([](u32 id, lv2_file& file)
{ {
if (std::memcmp("/dev_hdd1", file.name.data(), 9) == 0) if (std::memcmp("/dev_hdd1", file.name.data(), 9) == 0)
@ -108,6 +106,7 @@ error_code cellSysCacheClear()
// Clear existing cache // Clear existing cache
if (!cache->cache_id.empty()) if (!cache->cache_id.empty())
{ {
std::lock_guard lock0(g_mp_sys_dev_hdd1.mutex);
cache->clear(false); cache->clear(false);
} }
@ -149,6 +148,8 @@ error_code cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
return not_an_error(CELL_SYSCACHE_RET_OK_RELAYED); return not_an_error(CELL_SYSCACHE_RET_OK_RELAYED);
} }
std::lock_guard lock0(g_mp_sys_dev_hdd1.mutex);
// Clear existing cache // Clear existing cache
if (!cache->cache_id.empty()) if (!cache->cache_id.empty())
{ {