Fix atomic_clear_long_excl wrong return
When clearing a bit, we should check whether that bit is 0. Note atomic_clear_long_excl is not used. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Signed-off-by: Liu Qing <winglq@gmail.com> Closes #10526
This commit is contained in:
parent
8a3d9186ba
commit
a4b0a74c7f
|
@ -415,7 +415,7 @@ atomic_clear_long_excl(volatile ulong_t *target, uint_t value)
|
||||||
|
|
||||||
VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0);
|
VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0);
|
||||||
bit = (1UL << value);
|
bit = (1UL << value);
|
||||||
if ((*target & bit) != 0) {
|
if ((*target & bit) == 0) {
|
||||||
VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0);
|
VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue