Skip to content

Commit

Permalink
Fix atomic_clear_long_excl wrong return
Browse files Browse the repository at this point in the history
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 openzfs#10526
  • Loading branch information
winglq authored and jsai20 committed Mar 30, 2021
1 parent d597c6e commit 4256979
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/libspl/asm-generic/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ atomic_clear_long_excl(volatile ulong_t *target, uint_t value)

VERIFY3S(pthread_mutex_lock(&atomic_lock), ==, 0);
bit = (1UL << value);
if ((*target & bit) != 0) {
if ((*target & bit) == 0) {
VERIFY3S(pthread_mutex_unlock(&atomic_lock), ==, 0);
return (-1);
}
Expand Down

0 comments on commit 4256979

Please sign in to comment.