Make sure NHIT won't attempt to take the same semaphore twice

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial 2019-12-31 11:31:53 +01:00
parent 4536a51f59
commit 5eca548e22

View File

@ -312,7 +312,7 @@ static inline void write_lock_hashes(nhit_hash_t ctx, ocf_core_id_t core_id1,
if (lock_order[0] != ctx->hash_entries) if (lock_order[0] != ctx->hash_entries)
env_rwsem_down_write(&ctx->hash_locks[lock_order[0]]); env_rwsem_down_write(&ctx->hash_locks[lock_order[0]]);
if (lock_order[1] != ctx->hash_entries) if ((lock_order[1] != ctx->hash_entries) && (lock_order[0] != lock_order[1]))
env_rwsem_down_write(&ctx->hash_locks[lock_order[1]]); env_rwsem_down_write(&ctx->hash_locks[lock_order[1]]);
} }
@ -327,7 +327,7 @@ static inline void write_unlock_hashes(nhit_hash_t ctx, ocf_core_id_t core_id1,
if (hash1 != ctx->hash_entries) if (hash1 != ctx->hash_entries)
env_rwsem_up_write(&ctx->hash_locks[hash1]); env_rwsem_up_write(&ctx->hash_locks[hash1]);
if (hash2 != ctx->hash_entries) if ((hash2 != ctx->hash_entries) && (hash1 != hash2))
env_rwsem_up_write(&ctx->hash_locks[hash2]); env_rwsem_up_write(&ctx->hash_locks[hash2]);
} }