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 <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Liu Qing <[email protected]>
Closes #10526
  • Loading branch information
winglq authored Jul 6, 2020
1 parent 8a3d918 commit a4b0a74
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 a4b0a74

Please sign in to comment.